怎么获取本机系统类别?
一运行软件,在软件上会提示,本系统是xp还是win7?
public string GetOperationSystemInName()
{
OperatingSystem os = System.Environment.OSVersion;
string osName = "UNKNOWN";
switch (os.Platform)
{
case PlatformID.Win32Windows:
switch (os.Version.Minor)
{
case 0: osName = "Windows 95"; break;
case 10: osName = "Windows 98"; break;
case 90: osName = "Windows ME"; break;
}
break;
case PlatformID.Win32NT:
switch (os.Version.Major)
{
case 3: osName = "Windws NT 3.51"; break;
case 4: osName = "Windows NT 4"; break;
case 5: if (os.Version.Minor == 0)
{
osName = "Windows 2000";
}
else if (os.Version.Minor == 1)
{
osName = "Windows XP";
}
else if (os.Version.Minor == 2)
{
osName = "Windows Server 2003";
}
break;
case 6: osName = "Longhorn"; break;
}
break;
}
return String.Format("{0},{1}", osName, os.Version.ToString());
}