윈도우 플랫폼 체크
public string GetPlatform()
{
OperatingSystem osversion = System.Environment.OSVersion;
string winName = "";
switch (osversion.Platform)
{
case PlatformID.Win32Windows:
if (osversion.Version.Major == 4)
{
switch (osversion.Version.Minor)
{
case 0:
winName = "Windows 95";
break;
case 10:
winName = "Windows 98";
break;
case 90:
winName = "Windows Me";
break;
}
}
break;
case PlatformID.Win32NT:
if (osversion.Version.Major == 4)
{
winName = "Windows NT 4.0";
}
else if (osversion.Version.Major == 5)
{
switch (osversion.Version.Minor)
{
case 0:
winName = "Windows 2000";
break;
case 1:
winName = "Windows XP";
break;
case 2:
winName = "Windows Server 2003";
break;
}
}
else if (osversion.Version.Major == 6)
{
switch (osversion.Version.Minor)
{
case 0:
winName = "Windows Vista";
break;
case 1:
winName = "Windows 7";
break;
case 2:
winName = "Windows 8";
break;
case 3:
winName = "Windows 8.1";
break;
}
}
else if (osversion.Version.Major == 10)
{
switch (osversion.Version.Minor)
{
case 0:
winName = "Windows 10";
break;
}
}
break;
}//switch QUIT
return winName;
}
Operating system | Version number |
---|---|
Windows 10 | 10.0* |
Windows Server 2016 Technical Preview | 10.0* |
Windows 8.1 | 6.3* |
Windows Server 2012 R2 | 6.3* |
Windows 8 | 6.2 |
Windows Server 2012 | 6.2 |
Windows 7 | 6.1 |
Windows Server 2008 R2 | 6.1 |
Windows Server 2008 | 6.0 |
Windows Vista | 6.0 |
Windows Server 2003 R2 | 5.2 |
Windows Server 2003 | 5.2 |
Windows XP 64-Bit Edition | 5.2 |
Windows XP | 5.1 |
Windows 2000 | 5.0 |