Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

OS Info

by Anonymous Monk
on Feb 07, 2003 at 08:43 UTC ( [id://233398]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

How can I determine whether my AS 5.6..1 script is running under MSWin32 NT/2000/XP or MSWin32 95/98 etc?

use Config; print @Config{qw/osname archname/};

gives me the same info in both cases.

Replies are listed 'Best First'.
Re: OS Info
by ajt (Prior) on Feb 07, 2003 at 08:49 UTC

    Hi Anon,

    Try the following thread of nodes Which flavor of Win32? there are some clever and very detailed answers in there.


    --
    ajt

      Thanks. That's perfect.

        The simplest way is to use Win32::GetOSVersion() or Win32::GetOSName()

        --- demerphq
        my friends call me, usually because I'm late....

Re: OS Info
by helgi (Hermit) on Feb 07, 2003 at 14:29 UTC
    Here's one way:
    use warnings; use strict; use Win32; my ($servicepack,$major,$minor,$build,$id) = Win32::GetOSVersion; my $os; my $version = $major+($minor/10); $version = sprintf "%2.1f", $version; if ($id == 0 ) { $os = "Win32s"; } elsif ($id == 1 ) { $os = "Win95"; } elsif ($id == 2 ) { $os = "WinNT"; } else { $os = "Unknown"; } print "You are running $os version $version with $servicepack\n";

    --
    Regards,
    Helgi Briem
    helgi AT decode DOT is

Perl $^O values for various operating systems
by PodMaster (Abbot) on Feb 07, 2003 at 14:39 UTC
    I referred to the following table a bunch of times, it ought to be posted around here just in case it disappears from alma.ch.

    Also mirrored at http://crazyinsomniac.perlmonk.org/perl/misc/perloses.htm.


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    ** The Third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://233398]
Approved by pfaut
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found