I want to get Windows build version. I have searched everywhere for this, but to no avail.
No, I don't want to know if it's 7, 8, 10, or whatever. I don't want the Windows build number. I want to know the Windows build version (1507, 1511, 1607, etc.)
I am not sure what the official name of this would be, but here is an image of what I'm asking for:
I tried using the sys
, os
and platform
modules, but I can't seem to find anything built-in that can do this.
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
The build number is sufficient and can be found with:
sys.getwindowsversion().build
or the platform module. Match the build with the table at this link to determine the ReleaseId
you'd like to target:
In this case 1511
corresponds to TH2 and build 10586
:
# 1511 Threshold 2 November 10, 2015 10586
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With