Oooh, now I get it.
The only variable which holds information that can be used to identify the OS is the %OS% variable. That variable is set by default on all NT systems to "Windows_NT" (no quotes). It can be used to differ NT systems from Win9x/DOS.
However, if you need to determine the environment more exately, the way to go is to use the VER cmd, with the FIND cmd. Here goes the outputs:
Microsoft Windows 95 [...]
Microsoft Windows 98 [...]
Microsoft Windows 2000 [...]
Microsoft Windows XP [...]
Microsoft Windows NT [...]
MS-DOS 6.22
I'm not sure about the last two outputs, but I think they're right.
Those outputs will get you the exact environment, except for the Windows 9x, because when you get such output, you might be inside Windows or not. To determine if Windows is running, in that case, you can look for the switch /R on the XCOPY cmd help screen, which will only be present if Windows is running:
XCOPY/? |FIND "/R" > nul
if not errorlevel=1 goto Win
I think that happens because XCOPY runs in 16bit mode on DOS and 32bit mode on Windows.
I would classify the Microsoft OS's, by similarity, like this:
1. Win9x / DOS
a. Windows 95 / Windows 98
b. DOS
2. NT systems
a. Windows NT
b. Windows 2000 / Windows XP
And I'm not quite sure if Windows ME would be on the 1a block or in a block of itself, under the block 1 (like 1c).
I hope my analogy were understandable...
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br