7

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!

4

3 回答 3

12

正如其他人所指出的,使用 WMI。为此,请添加对 System.Management.dll 的引用,然后调用以下代码:

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

除了“名称”之外,WMI 还公开了有关您的处理器的其他有趣事实。查看http://msdn.microsoft.com/en-us/library/aa394373(VS.85).aspx以获取最终列表。

于 2010-04-25T15:16:39.257 回答
4
System.Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER")

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

于 2010-04-25T15:11:43.347 回答
3

如果可以使用 Windows 注册表,则查询:HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\ProcessorNameString

如果存在多个物理/逻辑处理器,则可能使用零以外的值

于 2020-05-09T19:53:25.693 回答