I'm creating installation wrappers for software deployments and having some problems obtaining the error code when launching MSI's using msiexec. Please take the following as an example of my installation string:

Run(msiexec /i "' & @WorkingDir & '\install_flash_player_11_active_x.msi" TRANSFORMS="' & @WorkingDir & '\AdobeFlash_ActiveX.mst" /qn /norestart', @WorkingDir, @SW_HIDE)

Within AutoIT, Run should set @error to non-zero if an error in the installation occurs. I've noticed however, that even if the installation fails, @error is set to 0 and so my source deems this as a success. My belief is that these return codes are based on Msiexec itself being successfully launched and not the installation launched by Msiexec. In turn, making it almost impossible for me to correctly report on unsuccessfull installations.

If anyone has any potential solutions for this it would be greatly appreciated.

有帮助吗?

解决方案

The @error value from Run only tells you whether the program was started correctly. The program is then started in the background and the script continues executing.

If you don't need to do any processing while the msi is installing, like mouse or keyboard automation, then using RunWait will return the exit code from the program.

Alternatively, if you need to use Run, then after doing your background processing use the ProcessWaitClose which returns the exit code of the program in @extended.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top