环境变量来确定操作系统类型(Windows XP,Windows 7) [英] Environment Variable to determine the OS type (Windows XP, Windows 7)

查看:169
本文介绍了环境变量来确定操作系统类型(Windows XP,Windows 7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个XML文件中区分Windows XP和Windows 7。以为我会在XML内部使用一个环境变量。

I want to differentiate between Windows XP and Windows 7 in a XML file. Thought i will use an environment variable for it inside the XML.

然而,我找不到在给出此信息的Windows中定义的任何系统环境变量。

However I could not find any system environment variable defined in windows that gives this information.

我看到%OSTYPE%变量,但它仅在Windows 7中可用。在XP中未定义。

I see the %OSTYPE% variable but it is only available in Windows 7. It is not defined in XP.

有没有可以这样做?

请注意,我想要一个纯粹依赖于系统的解决方案环境变量。我不想基于执行某些命令创建新变量,因为我想在XML文件中使用这个变量。

Note that i would like a solution which purely depends on system environment variables. I do not want to create new variables based on executing some command, because i want to use this variable in a XML file.

推荐答案

没有完全预设的环境变量,但是...

No exactly preset environment variables but...

以下是微软,它是指一个程序'gettype.exe',我不知道这是否是内置或不内置我不在ms窗口进行测试。无论如何,也许它可以帮助你。

The following is from microsoft and it refers to a program 'gettype.exe', I don't know if this is a built-in or not. I'm not on ms windows to test. Anyway, maybe it helps you.

http://support.microsoft.com / kb / 190899

另外,使用'ver'看起来内置

Also, with the 'ver' which looks built-in

使用'ver'的示例脚本 http://malektips.com/xp_dos_0025.html

Example script using 'ver' http://malektips.com/xp_dos_0025.html

这篇关于环境变量来确定操作系统类型(Windows XP,Windows 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆