简体   繁体   中英

Reading OS Version C#

I'm trying to get my os version using VersionString on .NET5. Here's the code (I found such an example somewhere on the inte.net).

string osVersion = Environment.OSVersion.VersionString;
Console.WriteLine("OS Version: " + osVersion);

The result is OS Version: Microsoft Windows NT 10.0.19043.0 However, I'm sure whether this is the correct result because my current OS version according to AIDA64 Business is 10.0.19043.1526. So I was wondering why the output of my program is 0 instead of 1526? Or mayde it doesn't matter?

The last set of digits is called the Update Build Revision (UBR) and can be accessed from the registry at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\UBR

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