This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: is there a (cygwin?) method delivering the current version of windows?


On Mon, Jan 24, 2005 at 09:22:30AM +0100, H. Henning Schmidt wrote:
> Hi all,
> I am looking for a method available to my cygwin'ed C-program that 
> delivers the current version of windows that my program is running on. 
> E.g. "WinXp, SP1", or "Win98 ..." (... you get the idea ...) either in 
> textual or numerically encoded form.
> Any hint is appreciated. Thanks,
> ;Henning

There's probably a much easier way, but:

$ perl -wle'print for Win32::GetOSVersion'
Service Pack 1
5
1
2600
2

This reports:

     Win32::GetOSVersion()
         [CORE] Returns the list (STRING, MAJOR, MINOR, BUILD, ID), where
         the elements are, respectively: An arbitrary descriptive string,
         the major version number of the operating system, the minor ver-
         sion number, the build number, and a digit indicating the actual
         operating system.  For the ID, the values are 0 for Win32s, 1 for
         Windows 9X/Me and 2 for Windows NT/2000/XP/2003.  In scalar con-
         text it returns just the ID.

         Currently known values for ID MAJOR and MINOR are as follows:

             OS                    ID    MAJOR   MINOR
             Win32s                 0      -       -
             Windows 95             1      4       0
             Windows 98             1      4      10
             Windows Me             1      4      90
             Windows NT 3.51        2      3      51
             Windows NT 4           2      4       0
             Windows 2000           2      5       0
             Windows XP             2      5       1
             Windows Server 2003    2      5       2

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]