C#获取系统版本信息
2012-03-21 19:06
363 查看
直接贴代码:
调用:
结果:
代码下载:http://download.csdn.net/detail/yysyangyangyangshan/4160546
public class OSInfoMation { public static string OSBit() { try { ConnectionOptions oConn = new ConnectionOptions(); System.Management.ManagementScope managementScope = new System.Management.ManagementScope("\\\\localhost", oConn); System.Management.ObjectQuery objectQuery = new System.Management.ObjectQuery("select AddressWidth from Win32_Processor"); ManagementObjectSearcher moSearcher = new ManagementObjectSearcher(managementScope, objectQuery); ManagementObjectCollection moReturnCollection = null; string addressWidth = null; moReturnCollection = moSearcher.Get(); foreach (ManagementObject oReturn in moReturnCollection) { addressWidth = oReturn["AddressWidth"].ToString(); } return addressWidth; } catch { return "获取错误"; } } public static string GetOsVersion() { string osBitString = OSBit(); string osVersionString = Environment.OSVersion.ToString(); return string.Format(@"系统:{0}。位:{1}", osVersionString, osBitString); } }
调用:
static void Main(string[] args) { Console.WriteLine(OSInfoMation.GetOsVersion()); Console.ReadLine(); }
结果:
系统:Microsoft Windows NT 5.1.2600 Service Pack 3。位:32
代码下载:http://download.csdn.net/detail/yysyangyangyangshan/4160546
相关文章推荐
- c#获取系统语言及版本信息
- C#获取系统版本信息
- C#获取系统版本信息
- c#获取系统语言及版本信息
- C#小技巧系列之三:获取系统进程信息
- [C#学习笔记]获取当前系统的基本信息
- 【WMI-5】WMI For C#/dotNet 用WMI获取系统信息
- Android获取系统cpu信息,内存,版本,电量等信息
- android系统信息(内存、cpu、sd卡、电量、版本)获取
- 解析Android获取系统cpu信息,内存,版本,电量等信息的方法详解
- 获取iphone的硬件版本以及系统信息
- 【C#】获取系统信息
- Android系统信息获取 之十三:Linux内核版本信息获取
- 在Visual C#winform中运用API函数获取系统信息
- windows API获取系统版本信息
- windows平台下 c++获取 系统版本 网卡 内存 CPU 硬盘 显卡信息
- C#中运用API函数获取系统信息
- python实现获取系统版本和mac信息上传到指定接口
- android系统信息(内存、cpu、sd卡、电量、版本)获取