antmar904

Once script for 32 and 64bit

3 posts in this topic

Hi,

Do we need to have two scripts one for 32 and one for 64bit when using the built in macros?

I am creating a installer for a program but first I check to see if the program is already installed by looking for the main exe in the program files dir by using @ProgramFilesDir.

If I run my script in 32bit on a 64bit computer it does not find the exe, but if I run the script in 64bit on my 64bit computer it finds the exe.

I really don't want to create two install scripts on for each OS arch if possible.

Share this post


Link to post
Share on other sites



Or I can do something like this

If @OSArch = "X64" Then
        Global $ProgramDir = "C:\Program Files"
    Else
        Global $ProgramDir = "C:\Program Files (x86)"
EndIf

 

Share this post


Link to post
Share on other sites

A 32 bit script, checking on which OS running, and calling some different funcs, should also do the job.

Quote

Running the 32-bit version of AutoIt on a x64 System

For Files, Windows has a special redirection mechanism for some system directories :

Directories 32-bit Value 64-bit Value
@SystemDir @WindowsDir & "\System32" @WindowsDir & "\SYSWOW64"
@ProgramFilesDir {SystemDrive} & "\Program Files (x86)" {SystemDrive} & "\Program Files"

It's possible to access the 64-bit version of those directories by disabling the redirection mechanism.

#include <WinAPIFiles.au3>

_WinAPI_Wow64EnableWow64FsRedirection(True)

Additional information can be found at MSDN.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now