Search code examples
windowsperluname

What are different possible values for POSIX::uname() release number on Windows?


I want to determine which version of Windows I'm on using POSIX::uname. I know it returns 6.2 on Windows 2012. I found a table of these values, Windows version and corresponding release number but I can't find it anymore. I've been searching the documentation, and I'm not able to run uname on every operating system to test it right now. Does anyone have a link or know which numbers correspond to which version of Windows?

http://perldoc.perl.org/perlport.html

http://perldoc.perl.org/POSIX.html


Solution

  • On Windows, POSIX::uname obtains its information from GetVersionEx whose parameter's documentation contains a table.

    The Win32 module provides more user-friendly calls.

    >perl -MWin32 -E"say Win32::GetOSDisplayName()"
    Windows 7 Professional (64-bit) Service Pack 1