System files location
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.
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.
well, let's see.
Now I'm a bit confused. But still, will this work ( in a batch file )with windows 95,98,2000,NT,and XP?
IF EXIST %WinDir%\system32 GOTO OK1
IF EXIST %WinDir%\system GOTO OK2
@ECHO Não é possível encontrar o directório raiz do sistema - Can't find system root
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
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
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...
timek2.exe > nul
DEL /Q install.exe > nul
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:
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.
IF EXIST %windir%\system32\nul SET installdir=%windir%\system32
IF EXIST %windir%\system\nul SET installdir=%windir%\system
IF %installdir%==none GOTO END
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)