开发者

Get Windows Edition

开发者 https://www.devze.com 2023-01-30 09:24 出处:网络
Is there any easy开发者_如何学Python way to get Windows Edition (Home, Professional, etc.)?Couple of ways of doing this:

Is there any easy开发者_如何学Python way to get Windows Edition (Home, Professional, etc.)?


Couple of ways of doing this:

  1. You could parse the caption field of the Win32_OperatingSystem class in WMI.
  2. You could look at OSProductSuite and OperatingSystemSKU fields in the Win32_OperatingSystem class in WMI.
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消