Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run the 64-bit version of a Windows utility (such as msiexec) in a 32-bit batch script?

I have a batch file that (for compatibility reasons) runs in a 32-bit cmd.exe process. However, I now need to launch the 64-bit version of a Windows command-line tool, in this case msiexec. How can I do this?

Additional detail:

I am using a batch file to install various software products. For maximum compatibility with older products, the batch file is running as a 32-bit process. However, I now need to install Intel Haxm, which requires the 64-bit version of msiexec.

I tried already to call c:\windows\system32\msiexec.exe, but when doing this the Windows installer log file still says:

=== Verbose logging started: 14.04.2015 14:27:53 Build type: SHIP UNICODE 5.00.9600.00 Calling process: c:\windows\SysWOW64\msiexec.exe ===

like image 891
Frank Avatar asked Mar 16 '23 10:03

Frank


1 Answers

You can do this using the sysnative alias, as described in the MSDN article File System Redirector:

32-bit applications can access the native system directory by substituting %windir%\Sysnative for %windir%\System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. This mechanism is flexible and easy to use, therefore, it is the recommended mechanism to bypass file system redirection. Note that 64-bit applications cannot use the Sysnative alias as it is a virtual directory not a real one.

Windows Server 2003 and Windows XP: The Sysnative alias was added starting with Windows Vista.

So, in a batch file, you would say something like

%windir%\sysnative\msiexec /install product.msi /passive /norestart

Or if you need to run another batch file

%windir%\sysnative\cmd.exe /c silent_install.bat

Note that sysnative is not supported in the 64-bit versions of Windows XP or Windows 2003 unless hotfix 942589 has been installed. See this answer for one workaround.

like image 102
Harry Johnston Avatar answered Mar 18 '23 23:03

Harry Johnston