Checking the version or the build number of Windows 10 is not very helpful because it doesn't change over time.
It turns out that first sentence is wrong; it was true in all previous versions of Windows, but we are in a new Windows 10 world now. The latest insiders build has a build number of 10525
compared to "RTM": 10240
.
There are several ways to get the build number on the command line:
systeminfo.exe
(Get-CimInstance -ClassName Win32_OperatingSystem -Namespace root/cimv2).BuildNumber
(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name CurrentBuild).CurrentBuild
The last of the three is the fastest.
If you prefer the GUI, you can use winver.exe or the About
entry in the Help
menu of most Windows desktop applications.
With no service packs around any more, the patch-level on the OS depends on the installed updates. There are several ways to find these, GUI, systeminfo.exe, wmi, etc.
The recommended and most powerful way to do things like this is using PowerShell:
Get-HotFix
shows something like:
Source Description HotFixID InstalledBy InstalledOn
------ ----------- -------- ----------- -----------
WIN10 Security Update KB3074663 NT AUTHORITY\SYSTEM 7/17/2015 12:00:00 AM
WIN10 Security Update KB3074667 NT AUTHORITY\SYSTEM 7/21/2015 12:00:00 AM
WIN10 Security Update KB3074674 NT AUTHORITY\SYSTEM 7/24/2015 12:00:00 AM
WIN10 Update KB3074678 NT AUTHORITY\SYSTEM 7/31/2015 12:00:00 AM
You can filter for updates in the last 10 days:
Get-Hotfix | Where {$_.InstalledOn -gt $(Get-Date).AddDays(-10) -and $_.Description -eq "Update"}
Or show the last three installed updates:
Get-Hotfix | Sort-object InstalledOn -Descending | Select -First 3
You can check whether a specific update is installed:
if ((get-hotfix -id kb3087916) -ne $null) {"patched..."}
You can first find the latest patch kb number online like:
(New-Object Net.WebClient).DownloadString('https://microsoft.com/...')
And then check whether it exists on the machine.
Note: this is just an example. I don't know of a page that currently lists these, and you still have to parse it.
The question is: Over time, will Microsoft change the functionality of Windows 10 so much that you have to check for it to make your app or script work.
It may be a better idea to check whether a specific feature you need exists on the system, rather than to look for a version number.