in reply to How to find out if it is 32bit or 64bit windows?

If you're not getting the desired result, then I think that you might have a dependency problem. First, check to see if Sys::Info::Driver::Windows::OS is installed. Better yet, run this script to make sure that everything's installed and uptodate.
#!perl use strict; use warnings; use CPAN; CPAN::Shell->install( "Params::Check", "Module::CoreList", "version", "Module::Load", "Locale::Maketext::Simple", "IPC::Cmd", "ExtUtils::CBuilder", "Config::General", "Win32API::Registry", "Win::TieRegistry", "Win32::OLE", "Win32API::Net", "Scalar::Util", "File::Spec", "File::Temp", "Exporter", "Capture::Tiny", "Sys::Info::Base", "Test::Sys::Info", "Test::Harness", "Test::More", "Sys::Info::Driver::Unknown", "Sys::Info::Driver::Windows::OS");
Then try this:
#!perl use strict; use warnings; use Sys::Info; use Sys::Info::Constants qw( :device_cpu ); my $info = Sys::Info->new; my $cpu = $info->device( 'CPU' ); printf "%s(%s bit)\n", scalar $cpu->identify, $cpu->bitness;

Replies are listed 'Best First'.
Re^2: How to find out if it is 32bit or 64bit windows?
by Anonymous Monk on Jun 22, 2011 at 07:01 UTC
    Thanks, it works now.

      Are you sure? It seems to me it's reporting the CPU bitness, not the OS bitness. When I run your original test it still reports bitness as '0'.

      I may be wrong but I don't believe it's safe to assume that CPU bitness == OS bitness.


      Dave

        I don't believe it's safe to assume that CPU bitness == OS bitness.

        You cannot run a 64-bit build of an OS on a 32-bit processor.

        You can run a 32-bit build of an OS on an (intel) 64-bit processor, but that is done by running the CPU in 32-bit compatibility mode, when for all intents and purposes, it is a 32-bit processor. So, whilst it may be possible to distinguish between the two scenarios, there is little benefit in doing so as none of the 64-bit facilities would be available to you.

        Leastwise, none that I can think of.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
        Hi davido,

        A couple of questions:

        • What's your Sys::Info::Driver::Windows::OS and Sys::Info and perl versions?
        • ActivePerl, Strawbery or your own build of perl?
        • What's your Windows version (XP, Vista, 7, etc)?
        • How did you install Sys::Info::Driver::Windows? (ppm, gcc, cl)?
        Thanks,
        Burak