Windows OS version list
Operating System |
PlatformID |
Major version number |
Minor version number |
Windows 95 |
1 |
4 |
0 |
Windows 98 |
1 |
4 |
10 |
Windows ME |
1 |
4 |
90 |
WindowsNT3.5 |
2 |
3 |
0 |
WindowsNT4.0 |
2 |
4 |
0 |
Windows2000 |
2 |
5 |
0 |
Windows XP |
2 |
5 |
1 |
Windows2003 |
2 |
5 |
2 |
Windows Vista |
2 |
6 |
0 |
Windows 7 |
2 |
6 |
1 |
Windows 8 |
|
|
|
Obtains the related classes or attributes of operating system information.
Copy codeThe Code is as follows: // obtain system information
System. OperatingSystem osInfo = System. Environment. OSVersion;
// Obtain the Operating System ID
System. PlatformID platformID = osInfo. Platform;
// Obtain the major version number
Int versionMajor = osInfo. Version. Major;
// Obtain the minor version number
Int versionMinor = osInfo. Version. Minor;
System. PlatformID enumerated values and their meanings
Copy codeThe Code is as follows: The Win32S operating system is of the Win32s (Win32 subset) type.
Win32s is a layer running on Windows 16-bit. It provides access to 32-bit applications.
The Windows operating system is Windows 95 or a newer version.
The Win32NT operating system is Windows NT or a newer version.
Windows CE is the Windows CE operating system.
The Unix operating system is Unix.
The Xbox development platform is Xbox 360.
Example
Copy codeThe Code is as follows: // C # determine whether the operating system is Windows 98
Public static bool IsWindows98
{
Get
{
Return (Environment. OSVersion. platform = PlatformID. win32Windows) & (Environment. OSVersion. version. minor = 10) & (Environment. OSVersion. version. revision. toString ()! = "2222A ");
}
}
// C # determine if the operating system is Windows 98 Version 2
Public static bool IsWindows98Second
{
Get
{
Return (Environment. OSVersion. platform = PlatformID. win32Windows) & (Environment. OSVersion. version. minor = 10) & (Environment. OSVersion. version. revision. toString () = "2222A ");
}
}
// C # determine whether the operating system is Windows2000
Public static bool IsWindows2000
{
Get
{
Return (Environment. OSVersion. platform = PlatformID. win32NT) & (Environment. OSVersion. version. major = 5) & (Environment. OSVersion. version. minor = 0 );
}
}
// C # determine whether the operating system is Windows XP
Public static bool IsWindowsXP {
Get {
Return (Environment. OSVersion. platform = PlatformID. win32NT) & (Environment. OSVersion. version. major = 5) & (Environment. OSVersion. version. minor = 1 );
}
}
// C # determine whether the operating system is Windows2003
Public static bool IsWindows2003
{
Get
{
Return (Environment. OSVersion. platform = PlatformID. win32NT) & (Environment. OSVersion. version. major = 5) & (Environment. OSVersion. version. minor = 2 );
}
}
// C # determine whether the operating system is Windows Vista
Public static bool IsWindowsVista
{
Get
{
Return (Environment. OSVersion. platform = PlatformID. win32NT) & (Environment. OSVersion. version. major = 6) & (Environment. OSVersion. version. minor = 0 );
}
}
// C # determine if the operating system is Windows 7
Public static bool IsWindows7
{
Get
{
Return (Environment. OSVersion. platform = PlatformID. win32NT) & (Environment. OSVersion. version. major = 6) & (Environment. OSVersion. version. minor = 1 );
}
}
// C # determine whether the operating system is Unix
Public static bool IsUnix
{
Get
{
Return Environment. OSVersion. Platform = PlatformID. Unix;
}
}