C# - 如何显示完整的 Windows 10 内部版本号? [英] C# - How to show the full Windows 10 build number?

查看:34
本文介绍了C# - 如何显示完整的 Windows 10 内部版本号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 C# 上显示完整的 Windows 10 版本?

How to show the full Windows 10 build on C#?

我目前正在使用 Environment.OSVersion.VersionString 但它没有显示完整的内部版本号

I'm currently using Environment.OSVersion.VersionString but it's not showing the full build number

结果:

微软视窗 NT 10.0.17134.0

Microsoft Windows NT 10.0.17134.0

但我想要最后一个数字,我的完整版本:10.0.17134.228

But I want the last number, my full build: 10.0.17134.228

我想知道如何显示最后一个丢失的号码.不仅在哪里可以找到号码.获取它的 c# 代码.

I want to know how can I show the last missing number. Not only where to find the number. The c# code to get it.

推荐答案

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.

这篇关于C# - 如何显示完整的 Windows 10 内部版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆