How to get CPU's model number like Core i7-860 on Windows?

前端 未结 7 2001
傲寒
傲寒 2021-02-15 18:08

There are many kinds of i7 CPU models as follows:

http://en.wikipedia.org/wiki/List_of_Intel_Core_i7_microprocessors#Desktop_processors

7条回答
  •  半阙折子戏
    2021-02-15 19:09

    You can check the Name Property of the Win32_Processor WMI class

    Try this C# sample

    using System;
    using System.Collections.Generic;
    using System.Management;
    using System.Text;
    
    namespace GetWMI_Info
    {
        class Program
        {
    
    
            static void Main(string[] args)
            {
                try
                {
                    string ComputerName = "localhost";
                    ManagementScope Scope;                
                    Scope = new ManagementScope(String.Format("\\\\{0}\\root\\CIMV2", ComputerName), null);
                    Scope.Connect();
                    ObjectQuery Query = new ObjectQuery("SELECT Name FROM Win32_Processor");
                    ManagementObjectSearcher Searcher = new ManagementObjectSearcher(Scope, Query);
                    foreach (ManagementObject WmiObject in Searcher.Get())
                    {
                        Console.WriteLine("{0}",WmiObject["Name"]);                     
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(String.Format("Exception {0} Trace {1}",e.Message,e.StackTrace));
                }
                Console.WriteLine("Press Enter to exit");
                Console.Read();
            }
        }
    }
    

提交回复
热议问题