VER

Display the current operating system version.

Syntax

      VER

Use ver to find specific operating systems like this:

@Echo off
Setlocal
:: Get windows Version numbers
For /f "tokens=2 delims=[]" %%G in ('ver') Do (set _version=%%G) 

For /f "tokens=2,3,4 delims=. " %%G in ('echo %_version%') Do (set _major=%%G& set _minor=%%H& set _build=%%I) 

Echo Major version: %_major%  Minor Version: %_minor%.%_build%

if "%_major%"=="5" goto sub5
if "%_major%"=="6" goto sub6

Echo unsupported version
goto:eof

:sub5
::Winxp or 2003
if "%_minor%"=="2" goto sub_2003
Echo Windows XP [%PROCESSOR_ARCHITECTURE%]
goto:eof

:sub_2003
Echo Windows 2003 or XP 64 bit [%PROCESSOR_ARCHITECTURE%]
goto:eof

:sub6
if "%_minor%"=="1" goto sub7
Echo Windows Vista or Windows 2008 [%PROCESSOR_ARCHITECTURE%]
goto:eof

:sub7
Echo Windows 7 or Windows 2008 R2 [%PROCESSOR_ARCHITECTURE%]
goto:eof

List of Windows Version numbers

Windows 1.0 1.04
Windows 2.0 2.11
Windows 3.0 3
Windows for Workgroups 3.11 3.11
Windows NT 3.1 3.10.528
Windows NT Workstation 3.5 3.5.807
Windows NT Workstation 3.51 3.51.1057
Windows NT Workstation 4.0 4.0.1381
Windows 95 4.0.950
Windows 95 OEM Service Release 1 (95A) 4.00.950
Windows 95 OEM Service Release 2 (95B) 4.00.1111
Windows 95 OEM Service Release 2.1 4.03.1212-1214
Windows 95 OEM Service Release 2.5 C 4.03.1214
Windows 98 4.1.1998
Windows 98 Second Edition 4.1.2222
Windows Me 4.90.3000
Windows 2000 5.00.2195
Windows 2000 Professional 5.0.2195
Windows XP (RC 1) 5.1.2505
Windows XP 5.1.2600
Windows XP, Service Pack 1 5.1.2600.1105-1106
Windows XP, Service Pack 2 5.1.2600.2180
Windows XP, Service Pack 3 5.1.2600
Windows XP Professional x64 Edition 5.2.3790
Windows Home Server 5.2.3790
Windows Server 2003 5.2.3790
Windows Server 2003, Service Pack 1 5.2.3790.1180
Windows Server 2003 5.2.3790.1218
Windows Vista, RTM (Release to Manufacturing) 6.0.6000.16386
Windows Vista 6.0.6000 Windows Server 2008 6.0.6001
Windows Vista, Service Pack 2 6.0.6002
Windows 7, RTM (Release to Manufacturing) 6.1.7600.16385
Windows 7 6.1.7600
Windows 7, Service Pack 1 6.1.7601
Windows Server 2008 R2, RTM (Release to Manufacturing) 6.1.7600.16385
Windows 8, RTM (Release to Manufacturing) 6.2.9200.16384
Windows 8 6.2.9200
Windows Server 2012 6.2.9200
Windows 8.1 6.3.9600.16384.130821-1623
Windows Server 2012 R2 6.3.9600

Service Pack Version

This Batch script will return the Service Pack level.

32 bit or 64 bit process detection

The environment variable %PROCESSOR_ARCHITECTURE% holds the following possible values:

64-bit process: AMD64 or IA64
32-bit process or WOW64 (32bit Program on 64 bit OS): x86

If we are running WOW64 then %PROCESSOR_ARCHITEW6432% =AMD64

IF PROCESSOR_ARCHITECTURE == x86 AND
 PROCESSOR_ARCHITEW6432 NOT DEFINED THEN
// OS is 32bit
ELSE
// OS is 64bit
END IF

via David Wang

VER is an internal command.

“Always be a first-rate version of yourself, instead of a second-rate version of somebody else” ~ Judy Garland

Related:

Q190899 - How to Determine the OS Type in a Logon Script
Gettype.exe - Resource Kit
WINVER.exe - Opens the GUI Version dialogue box (Help, About)
FILEVER - DLL version information (Resource Kit, XP Support tool)
OS version changes in Windows 8.1 and Windows Server 2012 R2
Wikipedia - Timeline of Microsoft Windows
Powershell: Get OS and Service pack
Equivalent bash command (Linux): uname -r - Print system information


© Copyright SS64.com 1999-2014
Some rights reserved