更新时间:2023-10-28 09:29:10
Windows 10 内部版本号 存储在注册表中 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\
的 UBR
键中.
The Windows 10 build number is stored in the registry in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\
in the UBR
key.
以下是在代码中获取它的方法:
Here's how to get it in code:
using Microsoft.Win32;
// ...
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
var buildNumber = registryKey.GetValue("UBR").ToString();
EDIT:修复了值名称以获得正确的 OP 编号.归功于 Jorge Aguiar 的正确钥匙.
EDIT: Fixed the value name to get the correct number for OP. Credit for the correct key to Jorge Aguiar.