Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 24 Jan 2005 03:12:08 -0800 From: Yitzchak Scott-Thoennes To: cygwin AT cygwin DOT com Subject: Re: is there a (cygwin?) method delivering the current version of windows? Message-ID: <20050124111208.GA3244@efn.org> References: <41F4B046 DOT 7010908 AT gmx DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41F4B046.7010908@gmx.net> User-Agent: Mutt/1.4.1i Organization: bs"d X-IsSubscribed: yes 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/