get windows 10 build version (release id)

  • Last Update :
  • Techknowledgy :

You can query the value using winreg module:

import winreg

def getReleaseId():
   key = r "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
val = r "ReleaseID"

with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key) as key:
   releaseId = int(winreg.QueryValueEx(key, val)[0])

return releaseId
import os

def getReleaseId():
   key = r "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
val = r "ReleaseID"

output = os.popen('REG QUERY "{0}" /V "{1}"'.format(key, val)).read()
releaseId = int(output.strip().split(' ')[-1])

return releaseId

The build number is sufficient and can be found with:

sys.getwindowsversion().build

In this case 1511 corresponds to TH2 and build 10586:

# 1511 Threshold 2 November 10, 2015 10586

You can use ctypes and GetVersionEx from Kernel32.dll to find the build number.

import ctypes
def getWindowsBuild():
   class OSVersionInfo(ctypes.Structure):
   _fields_ = [
      ("dwOSVersionInfoSize", ctypes.c_int),
      ("dwMajorVersion", ctypes.c_int),
      ("dwMinorVersion", ctypes.c_int),
      ("dwBuildNumber", ctypes.c_int),
      ("dwPlatformId", ctypes.c_int),
      ("szCSDVersion", ctypes.c_char * 128)
   ];
GetVersionEx = getattr(ctypes.windll.kernel32, "GetVersionExA")
version = OSVersionInfo()
version.dwOSVersionInfoSize = ctypes.sizeof(OSVersionInfo)
GetVersionEx(ctypes.byref(version))
return version.dwBuildNumber

I don't know of any libraries that will give you this value directly, but you can parse the command window output when you open a new command window via os.popen().

print(os.popen('cmd').read())

The boot screen for the command window has the version/build data on the first line. I'm running version 6.1, build 7601, according to the following output from os.popen():

Microsoft Windows[Version 6.1 .7601]
Copyright(c) 2009 Microsoft Corporation.All rights reserved.

C: \... >

Suggestion : 2

The VER command returns the Major/Minor / Build number, but does not include the Version/Release ID as displayed in Settings > About. , Mobile, Desktop and Server releases will have the same Version/Release ID but different build numbers.,The Release ID is a 4 digit code - a 2 digit year plus 2 digit planned month of release. 1703,1809... DisplayVersion is a 4 digit code - a 2 digit year plus H1 or H2.. for 1st, 2nd releases. 20H2, 21H1…, The ReleaseID is now deprecated and will return '2009' for 20H2 and all subsequent versions of Windows.

Display the current operating system version.

Syntax
VER

e.g. the following would also match "7.6.1"

ver | find "6.1" > nul
if % ERRORLEVEL % == 0 goto ver_2008R2

For Windows 10 up to May 2020 / 2004, this can be retrieved from the registry via the ReleaseID:

$release = (Get - ItemProperty - Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" - Name ReleaseId).ReleaseId

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 - WrapAuto

Batch file to find the current operating system version, for Vista and later:

@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

For Windows 10 up to May 2020 / 2004, this can be retrieved from the registry via the ReleaseID:

$release = (Get - ItemProperty - Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" - Name ReleaseId).ReleaseId

For all later versions, this can be retrieved from the registry via the DisplayVersion:

$ver = (Get - ItemProperty - Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" - Name DisplayVersion).DisplayVersion

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 - WrapAuto

Suggestion : 3

The Microsoft Windows operating system was first labelled with standard version numbers from 1 to 3.11 (read the full chapter [w])... then after some leaps and many years, in windows 10 the subsequent OS updates only incremented the build number and update build revision (UBR) number (see below).,In windows 10 the version number requested by the OP is based on the date of the most recent large build release and uses a YYMM format [2]. This version number is the one we can find e.g. via Settings panel, then System > About and we can read the Version (Shortcut Windows+I) and gives a prompter information about the OS update state.,Version[2] The version number gives you the best information on what version of Windows 10 you’re running. The number is based on the date of the most recent large build release and uses a YYMM format. For example, in the screenshot above, the “1607” version tells us that the version we’re running is from the 7th month (July) of 2016., 3 The big problem with this seems to be the inconsistency with the naming of the build numbers and the version numbers. What some refer to as the build number other's refer to as the version number and vice-versa – SpacePhoenix Jan 23, 2020 at 19:42

(Get - ItemProperty - Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId
Reg Query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | findstr ReleaseId
Reg Query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" / v ReleaseId

Powershell

Get - ComputerInfo - Property "WindowsVersion"

BTW from the command prompt you can directly ask to open winver and read the version number from the second line [3]...

winver

A List [4,R]

Windows 10(1903) 10.0 .18362
Windows 10(1809) 10.0 .17763
Windows 10(1803) 10.0 .17134
Windows 10(1709) 10.0 .16299
Windows 10(1703) 10.0 .15063
Windows 10(1607) 10.0 .14393
Windows 10(1511) 10.0 .10586
Windows 10 10.0 .10240

Windows 8.1(Update 1) 6.3 .9600
Windows 8.1 6.3 .9200
Windows 8 6.2 .9200

Windows 7 SP1 6.1 .7601
Windows 7 6.1 .7600

Windows Vista SP2 6.0 .6002
Windows Vista SP1 6.0 .6001
Windows Vista 6.0 .6000

Windows XP2 5.1 .26003
1._
(Get - ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId
(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId
(Get - ComputerInfo).WindowsVersion
1._
(gp 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId
(gp 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId
(gin).WindowsVersion