标签:
public static string getSystemName() { ManagementClass mc = new ManagementClass("Win32_OperatingSystem"); ManagementObjectCollection moc = mc.GetInstances(); String systemType = ""; foreach (ManagementObject mo in moc) { foreach (PropertyData pd in mo.Properties) { if (pd.Name == "Name") { systemType = pd.Value.ToString(); } } } if(string.IsNullOrEmpty(systemType)) { return null; } return (systemType.Split(‘|‘)[0].ToString()); }
标签:
原文地址:http://www.cnblogs.com/supergcl/p/4346778.html