c#

位置:IT落伍者 >> c# >> 浏览文章

用C#来判断当前系统是XP还是WIN7


发布日期:2023年07月04日
 
用C#来判断当前系统是XP还是WIN7

直接提供Winform程序

OperatingSystem os = EnvironmentOSVersion;

switch (osPlatform)

{

case PlatformIDWinWindows:

switch (osVersionMinor)

{

case :

labelText = "Windows ";

break;

case :

if (osVersionRevisionToString() == "A ")

labelText = "Windows 第二版 ";

else

labelText = "Windows ";

break;

case :

labelText = "Windows Me ";

break;

}

break;

case PlatformIDWinNT:

switch (osVersionMajor)

{

case :

labelText = "Windows NT ";

break;

case :

labelText = "Windows NT ";

break;

case :

switch (osVersionMinor)

{

case :

labelText = "Windows ";

break;

case :

labelText = "Windows XP ";

break;

case :

labelText = "Windows ";

break;

}

break;

case :

switch (osVersionMinor)

{

case :

labelText = "Windows Vista ";

break;

case :

labelText = "Windows ";

break;

}

break;

}

break;

}

当然大家直接可以通过 OperatingSystem os = EnvironmentOSVersion;然后判断osVersionMajor是否是等于就可以判断系统是不是windows Vista以上版本

上一篇:.Net实现合并文件的具体方法

下一篇:c#对PL/SQL查询结果列复制的结果生成指定格式