B
BrianB
I'm modifying a cmd script and need to know which type of Windows it's
running and if it is 32 or 64 bit. I've found several sites suggesting that
the ver command works to find the OS, but the suggestions do not cover all
version of XP and Vista. By trial and error I have ...
ver | find "2003" > nul
if %ERRORLEVEL% == 0 goto ver_2003
ver | find "Vista" > nul
if %ERRORLEVEL% == 0 goto ver_vista
ver | find "Microsoft Windows [Version 6.0" > nul
if %ERRORLEVEL% == 0 goto ver_xp
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
ver | find "Microsoft Windows [Version 5.2" > 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.
goto error
But I cannot find any definitive list of what ver returns for each OS. For
64-bit XP the ver output does not include the string "XP".
I haven't a clue how to determine if its a 32-bit or 64-bit OS.
Any suggestions?
Brian Bygland
running and if it is 32 or 64 bit. I've found several sites suggesting that
the ver command works to find the OS, but the suggestions do not cover all
version of XP and Vista. By trial and error I have ...
ver | find "2003" > nul
if %ERRORLEVEL% == 0 goto ver_2003
ver | find "Vista" > nul
if %ERRORLEVEL% == 0 goto ver_vista
ver | find "Microsoft Windows [Version 6.0" > nul
if %ERRORLEVEL% == 0 goto ver_xp
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
ver | find "Microsoft Windows [Version 5.2" > 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.
goto error
But I cannot find any definitive list of what ver returns for each OS. For
64-bit XP the ver output does not include the string "XP".
I haven't a clue how to determine if its a 32-bit or 64-bit OS.
Any suggestions?
Brian Bygland