Get Windows Version from the Registry with reg query
Read the precise Windows edition, feature update, and build number from HKLM\...\CurrentVersion for scripts and audits.
01Command
$ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v DisplayVersion
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber02What it does
The CurrentVersion key is the canonical version source that winver reads: ProductName (edition), DisplayVersion (22H2/23H2...), CurrentBuildNumber + UBR (full build like 22621.4317), and ReleaseId for older installs. Reading the registry works from CMD, batch, and even remote machines with reg query \\hostname\..., and parsing is more stable than scraping systeminfo output. In PowerShell, Get-ItemProperty on the same key gives the values as objects without string parsing.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- reg command referenceEvidence: Documents reg query syntax for reading registry values from CMD.
- reg - SS64Evidence: Reference for reg query including /v value matching and REG_SZ output parsing.
Last verified: 2026-09-17 · Category: System & Settings
06Related solutions
One command that shows OS version, install date, boot time, memory, network adapters and installed hotfixes.
Built-in Windows command to compute MD5, SHA1 or SHA-256 hashes of any file.
Remove hidden, system and read-only flags from files or whole directory trees.