in reply to How to determining if I am on .NET versus Windows 2003

What does this print?

use Win32; print Win32::GetOSName(),$/;

Update: Hmm, looks like it doesn't differentiate between them yet... so you will need to check the build numbers.

Replies are listed 'Best First'.
Re: Re: How to determining if I am on .NET versus Windows 2003
by PodMaster (Abbot) on Apr 04, 2003 at 18:15 UTC
    I think it works;)
    C:\>perl use Win32; local $\ = $/; print for Win32::GetOSName(),Win32->VERSION; __END__ Win2000 Service Pack 3 0.191 C:\>


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Yes, it works, sort of. If you have ActiveState Build 633 or later, Win32::GetOSName() is going to return "XP/.Net" for XP, .NET and Windows 2003.

Re: Re: How to determining if I am on .NET versus Windows 2003
by P0w3rK!d (Pilgrim) on Apr 04, 2003 at 18:42 UTC

    Windows .NET Enterprise Server:

    Windows version [2:5:2] unknown! at PERL2EXE_STORAGE/Win32.pm line 129

    Windows 2003 Server:

    Windows version [2:5:2] unknown! at PERL2EXE_STORAGE/Win32.pm line 129

    Thanks for your help. Do you know where the cutoff point for 2003 and .NET is? Are they 3600 and 3700, respectively??

    -P0w3rK!d

      I'm not sure. From the looks of it, neither is MS Operating System Properties.

      You might try running winver...

      1. Click Start | Run.
      2. In the Open box, type Winver.
      3. Click OK or press Enter.

        I'm just going to grab what I need for now. I was trying to look ahead to compiling on new Windows platforms using Perl, Java, and Ant. Based on your help, I wrote up the code I need so it's ready months down the road. I'm just going to key off the build version to diff btw 2003 Server and .Net Enterprise for now.

        Thanks :)

        -P0w3rK!d

        Mr. Muskrat,

        winver just opens a dialog with the information. That's not what I need, but thank you anyways. :)

        -P0w3rK!d

      I haven't done much with Win32 in perl and others have already stated the whole 'can you get the build version' but from what was given, it seems we know the following:
      1. build versions are the only difference in the given chart
      2. .NET has 36## for build version
      3. 2003 has 37## for build version
      First, since I don't know what the variables are for Config, I do the following:
      foreach $i (keys %Config) { print "$i\n"; }
      Perhaps a set variable based on what the build version is?
      Example:
      $build_prefix = substr Win32::GetBuild, 0, 2; if ($build_prefix == '36') { # do something for .NET } elsif ($build_prefix == '37') { # do something for 2003 }
      Course, it'd be better if I knew for sure you could get the build version from Config or Win32, but it's a helping hand! I'm probably going to go look it up soon anyways just to know, hehe...

      EDIT: after looking back over this, it seems the above code/etc is a really kludgy way of doing it and I probably should've done my homework before posting. Bah, I say...it's 12:30 and I'm still at work!