判断系统版本号

       //获取系统版本号
public static string GetOSType()
{
//定义系统版本
Version ver = System.Environment.OSVersion.Version;
string OSType = "";
//Major主版本号
//Minor副版本号
if (ver.Major == 5 && ver.Minor == 0)
{
OSType = "Windows 2000";
}
else if (ver.Major == 5 && ver.Minor == 1)
{
OSType = "Windows XP";
}
else if (ver.Major == 5 && ver.Minor == 2)
{
OSType = "Windows 2003";
}
else if (ver.Major == 6 && ver.Minor == 0)
{
OSType = "Windows Vista";
}
else if (ver.Major == 6 && ver.Minor == 1)
{
OSType = "Windows7";
}
else
{
OSType = "未知";
}
return OSType;
}


 

posted @ 2012-03-23 23:53  ghypnus  阅读(228)  评论(0编辑  收藏  举报