VER
Display the current operating system version.
Syntax
VER
Use ver to find specific operating systems like this:
@ECHO OFF
:: Win9x checks ::::::::::::
VER |find /i "Windows 95" >NUL
IF NOT ERRORLEVEL 1 GOTO W9598ME
VER |find /i "Windows 98" >NUL
IF NOT ERRORLEVEL 1 GOTO W9598ME
VER |find /i "Windows Millennium" >NUL
IF NOT ERRORLEVEL 1 GOTO W9598ME
:: NT/XP checks ::::::::::::
VER | find "XP" > nul
IF &qt;errorlevel&qt; EQU 0 GOTO s_win_XP
VER | find "2000" > nul
IF &qt;errorlevel&qt; EQU 0 GOTO s_win_2000
VER | find "NT" > nul
IF &qt;errorlevel&qt; EQU 0 GOTO s_win_NT
ECHO Unknown OS !
GOTO :EOF
:: Win9x commands ::::::::::::
:W9598ME
ECHO Win9x commands go here
GOTO :EOF
:W98
ECHO Win98 commands go here
GOTO :EOF
:: NT/XP commands ::::::::::::
:s_win_XP
ECHO XP commands go here
goto :eof
:s_win_2000
ECHO WIN2K commands go here
goto :eof
:s_win_NT
ECHO NT4 commands go here
goto :eof
:EOF (End-of-file)Service Pack Version
This Batch script will give the Service Pack level.
Works for NT, Win2K or WinXP
Bugs
The VER command reports the version of CMD.exe, so if for example you run the Win XP version of CMD under NT 4 then the VER command will return:
Microsoft Windows XP [Version 4.0.1381]