Launching MSI files is controlled by the msiexec
program. When we launch MSI file, the msiexec.exe
program is the one that's being launched for real, from the C:WindowsSystem32
folder.
This is why, as in the case of launching the other file types (taken up in the previous recipe), we can launch MSI files in two of the possible ways: launch the MSI file directly or pass it as a parameter to the msiexec
program.
Place the Calculator Plus installer (the CalcPlus.msi
file) to the root directory of C:\
.
In order to run an MSI file we need to perform the following steps:
function testRunMSI() { var msi1 = "C:\CalcPlus.msi"; var msi2 = "msiexec.exe /i C:\CalcPlus.msi"; var ws = Sys.OleObject("WScript.Shell"); ws.Run(msi1); ws.Run(msi2); }
The inner workings are the same as in the previous recipe; however, the only peculiarity is that, in order to launch the MSI file as a parameter of the msiexec
program, we will have to attach the parameter /i
to it, in order to signify the path to the installer, to be passed further on.
If the msiexec
program were to be launched without parameters, it would display only the window with the list of usable options that are available. For example, the /quiet
parameter allows launching silent mode installation, that is, without interacting with the user. This parameter is handy to use in case we need to install a new version of the tested application before running tests.
3.138.36.38