簡體   English   中英

為什么 Winver 顯示的版本不是 Powershell?

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

Winver VS Powershell 輸出

大家好? 為什么 Winver 向我顯示 Windows 版本 21H2 但 Powershell 命令 2009?

Get-ComputerInfo | select WindowsProductName, WindowsVersion

信息:使用我家里的個人電腦 Windows 11 Pro 21H2,它可以使用命令

Get-ComputerInfo | Select-Object -expand OSDisplayVersion

不幸的是,這個屬性在我的筆記本電腦上不存在,或者通常在 Win10 Enterprise 上不存在?

您可以通過從注冊表中獲取值來模仿 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:

Version 21H2 (Build 19044.1645)

UBR表示Update Build Revision

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM