如何获得我目前在Cygwin下运行的windows版本?
我正在维护一个在Mac、Windows和Linux发行版上运行的自动构建脚本,我需要能够检测它当前运行的Windows版本。
最好我可以让它返回标准的Windows版本名称,但我可以将某种代码与其他代码分开也很好。
我想知道的是我是否在运行7、XP、Server 2008等等。
帮助,想法?
如何获得我目前在Cygwin下运行的windows版本?
我正在维护一个在Mac、Windows和Linux发行版上运行的自动构建脚本,我需要能够检测它当前运行的Windows版本。
最好我可以让它返回标准的Windows版本名称,但我可以将某种代码与其他代码分开也很好。
我想知道的是我是否在运行7、XP、Server 2008等等。
帮助,想法?
像这样:
eh@winxpsp3 ~
$ echo `cmd /c ver`
Microsoft Windows XP [Version 5.1.2600]
eh@winxpsp3 ~
$
您可以从Windowssysteminfo
实用程序中删除它。
systeminfo | grep ^OS
仅操作系统名称:
systeminfo | sed -n s/^OS Name:[[:blank:]]*//p
示例:
$ systeminfo.exe | grep ^OS
OS Name: Microsoft Windows 7 Home Premium
OS Version: 6.1.7601 Service Pack 1 Build 7601
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
$ systeminfo | sed -n s/^OS Name:[[:blank:]]*//p
Microsoft Windows 7 Home Premium
您可以使用<code>uname-s</code>并将输出与以下内容进行比较:
NT-5.0=W2000
NT-5.1=XP
NT-6.0=Vista
NT-6.1=W7
I m running Windows 7 64 bit, so my output is:
CYGWIN_NT-6.1-WOW64
. You can see more information here.
I just asked a question about whether it was possible to write a web-page-checking code and run it from free web server, and one supporter answered and said that it was possible only if I run "a web ...
I am sorry if my question is silly and not at the right place. I know it s possible to write a script (in any programming language) that would check some webpage every 20 minutes, record its HTML ...
Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...
I like to write bash shell scripts on my iPhone, put them in an app folder with an icon, plist, etc., so they execute like apps by tapping their icon on SpringBoard. This is not interactive like ...
I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log ...
When I execute a Scala script from the command line, a directory named "tmp" is created in my home directory. It is always empty, so I simply deleted it without any apparent problem. Of course, when I ...
I have a project that uses ant to build and ivy for dependencies. I would like to generate the start scripts for my project, with the classpath, based on the dependencies configured in Ivy, ...
I m 试图撰写一个双面文字,处理一个文件清单,其名字在投入档案中每栏一栏储存,就像一个一样。