NT Syntax

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 %errorlevel% EQU 0 GOTO s_win_XP VER | find "2000" > nul IF %errorlevel% EQU 0 GOTO s_win_2000 VER | find "NT" > nul IF %errorlevel% 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)

Notice that 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]

Related Commands:

Q190899 - How to Determine the OS Type in a Logon Script
FILEVER - DLL version information (Resource Kit)

Equivalent Linux BASH commands:

uname -r - Print system information



Simon Sheppard
SS64.com