Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I want to copy files onto either Win9x or Win2K computers with a single batch file. The files will be copied into different locations depending on the OS. The batch file needs to identify which OS exists. I know the syntax is something like: IF EXIST c:\windows GOTO batch file lines or IF EXIST c:\winnt GOTO other batch file lines
I am looking for the exact syntax including any ":" etc. that may be needed.
Thanks

unclebyron wrote:
> I am looking for the exact syntax
> including any ":" etc. that may be
> needed.What the hell is that supposed to mean?
You must take as base something that can be compared. In all NT systems, the %OS% variable is set by default to "Windows_NT" (no quotes), and in other systems, such as Win9x or DOS, that variable is not set by default (though the user could set it). Using that would be something like this:
if "%OS%"=="Windows_NT" goto win2K
goto win9xAnother possibility is the output from the VER command:
ver |FIND "Windows 2000" > nul
if not errorlevel=1 goto win2K
ver |FIND "Windows 9" > nul
if not errorlevel=1 goto win9x
echo Your operating system is not supported.
goto eofThose are two possible and usual methods. I leave the choice to you.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

![]() |
Dos Help
|
how to compress files in ...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |