Display the current operating system version.
Syntax VER
A very simple method of version checking is to pipe a version string into FIND, however there is a possibility that something which is a unique string today might match a minor version released in the future.
e.g. the following would also match "7.6.1"
ver | find "6.1" > nul if %ERRORLEVEL% == 0 goto ver_2008R2
Batch file to find the current operating system version:
@Echo off For /f "tokens=4,5,6 delims=[]. " %%G in ('ver') Do (set _major=%%G& set _minor=%%H& set _build=%%I) Echo Major Version: [%_major%] Echo Minor Version: [%_minor%] Echo Build: [%_build%] Echo Architecture: [%PROCESSOR_ARCHITECTURE%] pause
The VER command returns the Major/Minor / Build number, but does not include the Version/Release ID as displayed in Settings > About.
The Release ID is typically a 4 digit code - a 2 digit year plus 2 digit month = the planned release date,
so 1709 means 2017 month 09 (September).
In practice the final release date can be a month or so later.Mobile, Desktop and Server releases will have the same Version/Release ID but different build numbers.
This Release ID can be retrieved from the registry with PowerShell:(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId
Windows Version Numbers Product name Major version / build Version / Release ID Windows 95 4.0.950 Windows XP 5.1.2600 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 8, RTM 6.2.9200.16384 Windows 10 Gold 10.0.10240 1507 Windows 10 November Update, 2015-11-03 10.0.10586 1511 Windows 10 Aniversary Update 2016-08-02 10.0.14393.1794 1607 Windows 10 Creators Update 2017-04-11 10.0.15063.674 1703 Windows 10 Fall Creators Update 2017-10-17 10.0.16299.19 1709 Windows 10 April 2018 Update 10.0.17134 1803 Windows 10 October 2018 Update 10.0.17763.55 1809 Windows 10 version 1903 (May 2019 Update) 10.0.18362.239 1903
Server versions Product name Major version / build Version / Release ID Windows Server 2003 5.2.3790 Windows Server 2008 6.0.6001 Windows Server 2008 R2, RTM 6.1.7600.16385 Windows Server 2012 6.2.9200 Windows Server 2012 R2 6.3.9600 Windows Server 2016 RTM 2016-09-26 10.0.14393 1607 Windows Server 2016 Aniversary Update 2017-03-22 10.0.14393.970 1703 Windows Server 2016 Fall Creators Update 10.0.16299.15 1709 Windows Server, version 1803 (Semi-Annual Channel) (Datacenter, Standard) 10.0.17134.1 1803 Windows Server, version 1903 10.0.18342 1903
See also Wikipedia list of Windows versions and Microsoft Windows 10 release history
PowerShell can be used to find the OS versions of multiple machines across a domain:
Get-ADComputer -Filter {OperatingSystem -like "Windows 10*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemVersion -Wrap –Auto
This batch script or this PowerShell script will return the Service Pack level.
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): x86If 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 IFvia David Wang @MSFT
If the version was successfully displayed %ERRORLEVEL% = 0
If a bad parameter is given %ERRORLEVEL% = 1
VER /? will not reset the ERRORLEVEL, this is a bug.
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:
Win32_OperatingSystem OperatingSystemSKU - Retrieve the OS Type via WMI (sku=Stock Keeping Unit ).
Sigcheck - Check a file version, both OS files and others.
SystemInfo - Return OS, Service pack, BIOS, Memory etc.
WINVER.exe - Opens the GUI Version dialogue box (Help, About)
Wikipedia - Timeline of Microsoft Windows
PowerShell equivalent: get the Operating System version
Equivalent bash command (Linux): uname -r - Print system information.