简体   繁体   English

为什么 Winver 显示的版本不是 Powershell?

[英]Why is Winver showing another Version than Powershell?

Winver VS Powershell 输出

Hello Guys?大家好? Why is Winver showing me Windows Version 21H2 but Powershell Command 2009?为什么 Winver 向我显示 Windows 版本 21H2 但 Powershell 命令 2009?

Get-ComputerInfo | select WindowsProductName, WindowsVersion

Info: With my Personal PC at home Windows 11 Pro 21H2, it works with the command信息:使用我家里的个人电脑 Windows 11 Pro 21H2,它可以使用命令

Get-ComputerInfo | Select-Object -expand OSDisplayVersion

Unfortunately this Property doesn`t exist at my Laptop, or maybe in general at Win10 Enterprise?不幸的是,这个属性在我的笔记本电脑上不存在,或者通常在 Win10 Enterprise 上不存在?

You can mimic the way winver.exe shows the current Windows version by taking the values from the registry:您可以通过从注册表中获取值来模仿 winver.exe 显示当前 Windows 版本的方式:

$v = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
# output like winver does
'Version {0} (Build {1}.{2})' -f $v.DisplayVersion, $v.CurrentBuildNumber, $v.UBR

Output: Output:

Version 21H2 (Build 19044.1645)

UBR means Update Build Revision UBR表示Update Build Revision

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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