www.webdeveloper.com
Results 1 to 4 of 4

Thread: System files location

  1. #1
    Join Date
    Jan 2004
    Posts
    16

    System files location

    Hi,

    Merry Christmas to all. I'm trying to make an install.bat to setup a program. But I have some doubts; actually they are two:

    1) In Windows XP the system folder is in c:\windows\system32 - I need to know the folder to copy eventual files that are missing;in general, I'm using "%SystemRoot%\system32\" ( without the quotes, of course ) to locate the folder; but what about Win 95, 98, ME, NT, 2000 ( and others major ones you might remember - I don't)? Is the system folder also "system32", or does it have other name?

    2)When I run the install.bat I would like that the cmd window would not appear or at least be minimized. Up until now, the only way I found is to use the "start" command. But does it exists in all the OS I mencioned above? And its location?

    Please answer as soon as possible.

    Regards,

    Kepler

  2. #2
    Join Date
    Nov 2002
    Location
    Dartmoor [Holiday]
    Posts
    2,382
    On Windows 95/98 systems, the system folder is usually C:\Windows\System. %SystemRoot% is not defined, but %WinDir% points to the Windows directory (usually C:\Windows).

    If you want to put files in the System directory, you should be very careful - this is usually not necessary. Possibly an installer created with Inno Setup or a similar program would be a better idea.

    I believe the start command exists on all the systems you mentioned.

    Adam
    "If you’re not using valid HTML, then you haven’t created a Web page. You may have created something else, but it isn’t a Web page." - Joe Clark

    Do something amazing (USA) | Make Poverty History

  3. #3
    Join Date
    Jan 2004
    Posts
    16

    well, let's see.

    Hi,

    Now I'm a bit confused. But still, will this work ( in a batch file )with windows 95,98,2000,NT,and XP?

    Code:
    @ECHO OFF
    IF EXIST %WinDir%\system32 GOTO OK1
    IF EXIST %WinDir%\system GOTO OK2
    @ECHO ON
    @ECHO Não é possível encontrar o directório raiz do sistema - Can't find system root
    GOTO END
    :OK1
    @ECHO OFF
    FOR %%Z IN (*.*) DO IF NOT EXIST %WinDir%\system32\%%Z COPY %%Z /Y %WinDir%\system32\%%Z > nul
    DEL /Q %WinDir%\system32\install.exe > nul
    DEL /Q %WinDir%\system32\TK.exe > nul
    DEL /Q %WinDir%\system32\update.dat > nul
    GOTO OK3
    :OK2
    @ECHO OFF
    FOR %%Z IN (*.*) DO IF NOT EXIST %WinDir%\system\%%Z COPY %%Z /Y %WinDir%\system\%%Z > nul
    DEL /Q %WinDir%\system\install.exe > nul
    DEL /Q %WinDir%\system\TK.exe > nul
    DEL /Q %WinDir%\system\update.dat > nul
    :OK3
    IF EXIST %WinDir%\system32\regsvr32.exe FOR %%Z IN (*.*) DO %WinDir%\system32\regsvr32 /S %WinDir%\system32\%%Z > nul
    IF NOT EXIST %WinDir%\system32 IF EXIST %WinDir%\system\regsvr.exe FOR %%Z IN (*.*) DO %WinDir%\system\regsvr /S %WinDir%\system\%%Z > nul
    DEL /Q *.dll > nul
    DEL /Q *.ocx > nul
    DEL /Q *.tlb > nul
    @ECHO Aguarde um momento...Please wait...cleaning...
    @ECHO "Waiting..."
    timek2.exe > nul
    @ECHO Concluído...Done...
    DEL /Q install.exe > nul
    :END
    Regards,

    Kepler

  4. #4
    Join Date
    Nov 2002
    Location
    Dartmoor [Holiday]
    Posts
    2,382
    It looks ok, but there's really no substitute for testing on as many systems as possible. I'm not sure if copying a load of files into the system folder is a good idea at all, and I think an installation package would be better.

    The code would be cleaner if you did something like this at the start, and then used %installdir% thereafter:
    Code:
    SET installdir=none
    IF EXIST %windir%\system32\nul SET installdir=%windir%\system32
    IF EXIST %windir%\system\nul SET installdir=%windir%\system
    IF %installdir%==none GOTO END
    Also bear in mind that some versions may have both \System and \System32 directories, so you might not get the right one. You only really need the @ECHO OFF at the start - it is not necessary to turn it back on again to display a message with ECHO. I'd also make sure you are starting in the right directory, because if not you might delete a load of important .EXE, .DLL and .OCX files.

    Adam
    "If you’re not using valid HTML, then you haven’t created a Web page. You may have created something else, but it isn’t a Web page." - Joe Clark

    Do something amazing (USA) | Make Poverty History

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles