slojuggler has asked for the wisdom of the Perl Monks concerning the following question:
Without using Microsoft's gettype.exe, is there a quick-and-dirty Perlish way of determining whether the system running a script is Win2k Pro, Win2k Server, WinNT 4 Workstation, WinNT 4 Server? If not, could somebody point me into the right direction, or could point me to other alternatives aside from gettype.exe?
Thanks.
Re: Determine the Windows OS Running
by $code or die (Deacon) on Nov 29, 2001 at 00:57 UTC
|
Yes, use Win32::GetOSVersion()
Look at Re: Windows Version Detection for a previous discussion on the subject.
Simon Flack ($code or die)
$,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
=~y'_"' ';eval"die";print $_,lc substr$@,0,3;
| [reply] [Watch: Dir/Any] |
Re: Determine the Windows OS Running
by jlongino (Parson) on Nov 29, 2001 at 01:01 UTC
|
slojuggler I did quite a bit of research on this recently
so you may find something useful from Windows Version
Detection. The best method would be to expand on
Re: Re: Re: Re: Windows Version Detection by
filling out the rest of the chart and put some additional
logic as well. I stopped once I had arrived at what I
needed but it looks like you need more.
--Jim
Update: It seems I got much of the info piecing
together web searches for getosversion and VB snippets from
MSDN developer pages. HTH. | [reply] [Watch: Dir/Any] |
Re: Determine the Windows OS Running
by Rich36 (Chaplain) on Nov 29, 2001 at 00:24 UTC
|
From the camel...
You can use $^0, which is a Perl special variable that holds the OS name.
Or....
Use the module Config.pm and use the variable $Config{osname}
Rich36
There's more than one way to screw it up...
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
| [reply] [Watch: Dir/Any] |
|
It appears you are correct...
I got "MSWin32" as a value for both $^O and $Config{osname} running on NT, so my prior comment should be stricken/ignored in the context of this question.
I should really test before I post unless I know for sure what I'm talking about...
/me --
Rich36
There's more than one way to screw it up...
| [reply] [Watch: Dir/Any] [d/l] [select] |
|