Get Windows Edition
Is there any easy开发者_如何学Python way to get Windows Edition (Home, Professional, etc.)?
Couple of ways of doing this:
- You could parse the
captionfield of theWin32_OperatingSystemclass in WMI. - You could look at
OSProductSuiteandOperatingSystemSKUfields in theWin32_OperatingSystemclass in WMI. - You could port this C++ program using P/Invoke.
If you reference the Microsoft.VisualBasic.Devices namespace you can do this:
ComputerInfo computerInfo = new ComputerInfo();
string fullName = computerInfo.OSFullName; // i.e. "Microsoft Windows 7 Ultimate"
You can use Microsoft.VisualBasic in your c# apps - it's just like any other library.
Easy answer? Just look in the registry.
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion
It doesn't have the overhead of WMI (50ms every call), and it gives the full name.
加载中,请稍侯......
精彩评论