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
        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..

Answer Summary:
0 Comments   [ + ] Show Comments


Please log in to comment



have a read of this thread:


Answered 04/25/2012 by: pjgeutjens
Red Belt

Please log in to comment

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

Answered 04/25/2012 by: andibogard
Blue Belt

Please log in to comment
Answer this question or Comment on this question for clarity