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.

WindowsregistrycmdversionLow risk
Run reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v DisplayVersion to get the feature update (e.g. 23H2) and CurrentBuildNumber for the build.

01Command

Command
$ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v DisplayVersion
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber

02What 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

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • reg command reference
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents reg query syntax for reading registry values from CMD.
  • reg - SS64
    SS64 · technical · 2026-09-17
    Evidence: Reference for reg query including /v value matching and REG_SZ output parsing.

Last verified: 2026-09-17 · Category: System & Settings

06Related solutions