If I'm in CMD I can use winver
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)?
1 Answer
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')