/build/static/layout/Breadcrumb_cap_w.png

which method of scripting is adviced for determinig OS architechture..??

I'm very new to scripting, I have two scripts for determinig architechture

one is using the function :

function Determine64BitMode
    dim Shell, Is64BitOs
    set Shell = CreateObject("WScript.Shell")
    on error resume next
    Shell.RegRead "HKLM\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir (x86)"
    Is64BitOs = Err.Number = 0
    on error goto 0
    if Is64BitOs then
        Determine64BitMode = InStr(Shell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir"), "(x86)") = 0
    else
        Determine64BitMode = false
    end if
end function

and the other is :

Shell.ExpandEnvironmentStrings( "%PROCESSOR_ARCHITECTURE%" )

But few people adviced me not to use the later one,

Can anyone spare some time in showing me lights on this..


0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: pjgeutjens 11 years ago
Red Belt
2

have a read of this thread:

http://stackoverflow.com/questions/1738985/why-processor-architecture-always-returns-x86-instead-of-amd64

Posted by: andibogard 11 years ago
Blue Belt
2

For batch files, I test to see if ProgramFiles(x86) is defined as an environment variable

If defined ProgramFiles(x86) goto 64bit

 

For Powershell, i use test-path "c:\Program Files (x86)" or (Get-WmiObject Win32_OperatingSystem).OSArchitecture

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ