This article is a mirror article of machine translation, please click here to jump to the original article.

View: 21208|Reply: 0

[Console Program] C# to identify system version and Win10

[Copy link]
Posted on 2019-10-23 09:15:45 | | | |
We all know that in C#, the current operating system can be judged by Environment.OSVersion, and the following is the correspondence between the operating system and the primary and secondary versions:

Operating system
Main version. sub-version
Windows 1010.0*
Windows Server 2016 Technical Preview10.0*
Windows 8.16.3*
Windows Server 2012 R26.3*
Windows 86.2
Windows Server 20126.2
Windows 76.1
Windows Server 2008 R26.1
Windows Server 20086
Windows Vista6
Windows Server 2003 R25.2
Windows Server 20035.2
Windows XP 64-Bit Edition5.2
Windows XP5.1
Windows 20005

We can use Environment.OSVersion to determine the current operating system

However, when you are inwin10Using this function on the operating system will give you the following result:6.2.9200.0, instead of the 10.0.*** we were expecting.

The problem is that the value obtained under Win10 may not be 10, indicating the address:The hyperlink login is visible.

For applications that have been manifested for Windows 8.1 or Windows 10. Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2). To manifest your applications for Windows 8.1 or Windows 10, refer to Targeting your application for Windows.
A program manifest file is now required



Then remove the comments below and you can return to 10.0.****





There is another way to do this:

Use C# to determine whether the current operating system is Win8 (This method does not require the addition of a program manifest file)

Code:

(End)




Previous:[Crawler Tutorial] The most complete crawler tutorial collected by individuals
Next:Introduction to Storage for Cainiao: Understand the basic knowledge of network storage
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com