/build/static/layout/Breadcrumb_cap_w.png

Script or MI that runs based on 64 or 32 bit

This little batch file scriptlet will allow you to run a command based on architecture:

set ProgFiles86Root=%ProgramFiles(x86)%

IF NOT "%ProgFiles86Root%"=="" (
vcredist_x64.exe /q /norestart
) ELSE (
vcredist_x86.exe /q /norestart
)


As you can see replacing the vcredist_x64.exe /q /norestart with another command specific to 64 bit will run if it finds a Program Files (x86). Else, it runs the next command that would be 32bit.

There may be a more elegant way of doing it, but here ya go anyway. Plop this in a batch file and set it as an MI and you are able to have only one MI for both architectures.

0 Comments   [ + ] Show comments

Answers (2)

Posted by: cmccracken 13 years ago
Orange Senior Belt
1
Interesting. I've used


IF EXIST "C:\Windows\SysWOW64" (
run something for x64
) ELSE (
run something for x86
)


Casey
Posted by: snissen 13 years ago
Fourth Degree Green Belt
0
Batch files are scripts run by cmd.exe. But which cmd.exe: the one in %SystemRoot%\system32, the one in %SystemRoot%\SysWOW64, or the one in %SystemRoot%\sysnative? It does matter! Windows tries very hard to hide the 64-bit environment when you run a 32-bit executable.

I was totally baffled by these differences until I attended this one day online class:
http://csi-windows.com/courses/windows64bit

Need some convincing? I found these two blogs useful:
http://csi-windows.com/toolkit/csi-getosbits and
http://csi-windows.com/blog/all/27-csi-news-general/263-how-windows-installer-processes-packages-on-64-bit-windows

I highly recommend Darwin's insights. Sande
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
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