3

If I'm in CMD I can use winver

enter image description here

I can see my OS version is 20H2 now. But this is GUI result, I want to use command line to make it. If I use

ver

Microsoft Windows [版本 10.0.19042.868]

If I'm in powershell, I can use

Get-ComputerInfo WindowsVersion
WindowsVersion
-------------- 
2009

So how to get the version like "20H2" in command line(powershell or cmd)?

yode
  • 733

1 Answers1

3

The value can be found under registry key Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion inside the value named DisplayVersion.

The following PowerShell command will get it:

(Get-Item "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue('DisplayVersion')
harrymc
  • 498,455