How can I get the processor NAME of my machine usi

2019-02-18 08:22发布

I need to find the Name and speed of the processor on my machine. I'm building an open source help desk suite and finding this really entertaining!

Thanks for the help guys!

2条回答
甜甜的少女心
2楼-- · 2019-02-18 08:32

As the others have pointed out, using WMI. Do this by adding a reference to System.Management.dll, then calling the following code:

ManagementObjectSearcher mos = 
  new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor");
    foreach (ManagementObject mo in mos.Get()) {
      Console.WriteLine(mo["Name"]);
    }

Besides "Name", WMI also exposes other interesting facts about your processor. Take a look at http://msdn.microsoft.com/en-us/library/aa394373(VS.85).aspx for the definitive list.

查看更多
聊天终结者
3楼-- · 2019-02-18 08:47
System.Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER")

will get you something. You'll need to decode it though.

查看更多
登录 后发表回答