How can I programmatically determine my processor

2020-03-19 03:46发布

How can I determine programmatically whether my machine is an x86, x64 or an IA64?

7条回答
SAY GOODBYE
2楼-- · 2020-03-19 04:20

In C#:

using System;
using Microsoft.Win32;

  class Class1
  {
    static void Main(string[] args)
    {
      RegistryKey RegKey = Registry.LocalMachine;
      RegKey = RegKey.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
      Object cpuSpeed = RegKey.GetValue("~MHz");
      Object cpuType  = RegKey.GetValue("VendorIdentifier");
      Console.WriteLine("You have a {0} running at {1} MHz.",cpuType,cpuSpeed);
    }
  }
查看更多
登录 后发表回答