I have to install a driver during my installation process in InnoSetup
. For that I have two .msi installation files for 32bit/64bit. Now in Win7, this driver is already included, so I don't need to install it again. So far, I did this:
[Tasks]
Name: "install_usb"; Description: "Install USB driver"; GroupDescription: "Drivers:";
[Files]
Source: "xy\driver\*"; DestDir: "{tmp}"
[Run]
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\driver_32bit.msi"""; StatusMsg: "Installing 32bit USB driver"; Check: not IsWin64(); Tasks: install_usb; Flags: skipifsilent
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\driver_64bit.msi"""; StatusMsg: "Installing 64bit USB driver"; Check: IsWin64(); Tasks: install_usb; Flags: skipifsilent
So, the user can choose if he wants to install the driver. If he has chosen to do so, the correct driver runs. This works fine. Now I want to choose to not install the driver if >=Win7 is running. I read about OnlyBelowVersion: 6.1
but I seem to be unable to do something like this in the [Run]
section:
[Run]
... Check: IsWin64() and OnlyBelowVersion:6.1; ...
How can I use OnlyBelowVersion
(or something similar) in the [Run]
section?
Also, I want to make sure that the .msi is run in the proper mode (64bit mode for 64bit systems). Because I think, that is not the case right now. Is it possible to enforce that? I found out about ArchitecturesInstallIn64BitMode=x64
, where do I have to put that?
The OnlyBelowVersion
parameter you can't use in Check
statement, but as a separate parameter.
[Run]
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\driver_32bit.msi"""; OnlyBelowVersion: 6.1; StatusMsg: "Installing 32bit USB driver"; Check: not IsWin64(); Tasks: install_usb; Flags: skipifsilent
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\driver_64bit.msi"""; OnlyBelowVersion: 6.1; StatusMsg: "Installing 64bit USB driver"; Check: IsWin64(); Tasks: install_usb; Flags: skipifsilent
To you second question, the IsWin64
function returns True on all 64-bit editions of Windows, so that's what you have correct. From the reference:
This function will always return True on an x64 edition of Windows.
To run your InnoSetup installation in 64-bit mode you've correctly mentioned, that you need to specify at least the ArchitecturesInstallIn64BitMode
directive. If you specify this directive with at least one of the available values, your setup will run in 64-bit mode on machines with the processor architecture(s) you specify, in 32-bit mode if you run your setup on machine with x86 processor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With