Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get windows version in Cygwin

How can I get the windows version I am currently running under Cygwin?

I am maintaining a automatic build script that is running on Mac, Windows and Linux distributions and I need to be able to detect what Windows version it is currently running under.

Preferably I could have it return the standard Windows release name but some kind of code that I can separate from the other ones would also be great.

What I want to know is if I am running 7, XP, Server 2008 and so on.

Help, Ideas?

like image 216
Sedrik Avatar asked May 30 '11 13:05

Sedrik


People also ask

How do I know what version of Cygwin I have Windows?

The -c option checks the version and status of installed Cygwin packages. If you specify one or more package names, cygcheck will limit its output to those packages, or with no arguments it lists all packages. A package will be marked Incomplete if files originally installed are no longer present.

What is cygwin64 terminal?

Cygwin is a collection of open source tools that allows Unix or Linux applications to be compiled and run on a Microsoft Windows operating system (OS) from within a Linux-like interface. Cygwin offers users a Linux-like experience in a Windows environment.

How do I view Cygwin files?

If you right-click on a . txt file and select "open with" you should be able to click "Browse" and go to C:\cygwin\bin\vim-nox.exe . Then you can click "Always use the selected program to open this kind of file". However, I prefer to just have a "native" Windows Vim install and use that.


2 Answers

You can grep it out of the Windows systeminfo utility.

systeminfo | grep '^OS'

OS name only:

systeminfo | sed -n 's/^OS Name:[[:blank:]]*//p'

Example:

$ 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
like image 152
Costa Avatar answered Sep 22 '22 13:09

Costa


You could use uname -s and compare the output to this:

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.

like image 34
keyboardP Avatar answered Sep 23 '22 13:09

keyboardP