How can I programmatically determine my processor type?

后端 未结 7 584
清歌不尽
清歌不尽 2021-01-13 01:03

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

相关标签:
7条回答
  • 2021-01-13 01:42

    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);
        }
      }
    
    0 讨论(0)
提交回复
热议问题