1 public  String Judge64or32System()
 2         {
 3             try
 4             {
 5                 String addressWidth = String.Empty;
 6                 System.Management.ConnectionOptions mConnOption = new System.Management.ConnectionOptions();
 7                 System.Management.ManagementScope mMs = new System.Management.ManagementScope("\\\\localhost", mConnOption);
 8                 System.Management.ObjectQuery mQuery = new System.Management.ObjectQuery("select AddressWidth from Win32_Processor");
 9                 System.Management.ManagementObjectSearcher mSearcher = new System.Management.ManagementObjectSearcher(mMs, mQuery);
10                 System.Management.ManagementObjectCollection mObjectCollection = mSearcher.Get();
11                 foreach (System.Management.ManagementObject mObject in mObjectCollection)
12                 {
13                     addressWidth = mObject["AddressWidth"].ToString();
14                 }
1
16                 return addressWidth;
17             }
18             catch (Exception ex)
19             {
20                 Console.WriteLine(ex.ToString());
21                 return String.Empty;
22             }
23         }

 

posted on 2018-10-10 09:59  花生豆角  阅读(1185)  评论(0编辑  收藏  举报