Get Windows version in Cygwin

How can I get the version of Windows that I am running under Cygwin now?

I support automatic build scripts that run on Mac, Windows, and Linux distributions, and I need to determine which version of Windows it is currently using.

It is desirable that it return the standard name of the Windows release, but some code that I can separate from others will also be great.

What I want to know if I run 7, XP, Server 2008, etc.

Help, ideas?

+3
source share
3 answers

Like this:

eh@winxpsp3 ~
$ echo `cmd /c ver`
 Microsoft Windows XP [Version 5.1.2600]

eh@winxpsp3 ~
$
+4
source

You can use uname -sand compare the result with this:

NT-5.0 = W2000

NT-5.1 = XP

NT-6.0 = Vista p>

NT-6.1 = W7

64- Windows 7, : CYGWIN_NT-6.1-WOW64. .

+7

Windows systeminfo.

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
+6
source

All Articles