简体   繁体   中英

How to get the correct Windows version from command line

How to get the correct Windows version from command line, PowerShell included?

As I've tried all solutions/answers from How to find the Windows version from the PowerShell command line , but none is able to give this now:

在此处输入图像描述

You can retrieve it from the registry:

Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' DisplayVersion

Note:

  • Apparently only works in version 20H2 and above.
  • Prior to that, winver.exe (whose screenshot is shown in the question), apparently showed the ReleaseId registry value (in lieu of DisplayVersion above).

PS> Winver

Not kidding. One would expect this info to be in Get-ComputerInfo, but it isn't.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM