DOS batch file to determine Windows 2000 version
Posted on 2007-12-04
I came across this DOS batch file in my search for a way to determine the Windows version:
ver | find "2003" > nul
if %ERRORLEVEL% == 0 goto ver_2003
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
ver | find "2000" > nul
if %ERRORLEVEL% == 0 goto ver_2000
ver | find "NT" > nul
if %ERRORLEVEL% == 0 goto ver_nt
echo Machine undetermined.
:Run Windows 2003-specific commands here.
echo Windows 2003
:Run Windows XP-specific commands here.
echo Windows XP
:Run Windows 2000-specific commands here.
echo Windows 2000
:Run Windows NT-specific commands here.
echo Windows NT
I haven't found out yet whether or not Vista can be included in the script.
However, to me this is not important in this specific situation. I only need to know if people are running Windows 2000 or not so I can probably just delete the other versions, which thereby will de directed to "Machine undetermined".
But it would be nice to expand the script to also distinguise between:
2000 Advanced Server
2000 Datacenter Server
Does anyone have an idea how to make that work? I tried adding the word "Professional" and the number "5.00.2195" in the batch file, but that didn't work ("Machine undetermined").