How can I get the OS details using C# code in my WPF application?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Using the registry is something that is possible for any application. In C# I have made myself a utility class for this. Note that Microsoft has changed the key for Windows 10+ (which this class is designed to already handle). The class should give you the information you need, I think:
The Environment class provides properties that can be used to obtain system information.
You can get OS information from System. Environment.OSVersion Here
Since I only have to care about non server editions, I do:
If you really need to consider server editions as well, then your options are:
WMI, you will have to some manual parsing. Not sure if user privilege is going to hurt non admin users.
GetVersionEx as described in this answer.
Checking for
ProductName
atIsOS function, as described in this answer. Of all I prefer this..
I provided a bit more complete answer here.
Have a look at System.Environment It has property OSVersion