PowerShell - Run external program with parameters
I'm trying to run an InstallShield setup with a series of parameters from a PowerShell script:
$dir = Split-Path $scriptpath & "$dir\policeROADSsetup.exe" -s -SMS -f1`"$dir\Win7\setup.iss`"
The executable runs, MSIEXEC reports success, but the setup returns an exit code of -3 and the software is not installed. I can put this code into a CMD file:
"%~dp0\policeROADSsetup.exe" -s -SMS -f1"%~dp0\WinXP\setup.iss"
And call it in the PowerShell script:
And this works just find. Software installes, exit code 0. Any suggestions on how I can get this to install without have to resort to a one-line CMD file? Thanks a bunch.
$install = start-process -filepath "policeROADsetup.exe" -argumentlist '-s -SMS -f1 \Win7\setup.iss' -wait -passthru
Not sure about the relative path reference for the setup.iss file, but worst case scenario, move it to the same folder as the setup.exe?
Also, you can use double quotes inside the argumentlist if needed because it's enclosed in single quotes. You won't be able to resolve variables in there though.
I am not sure what you have written in other parts of your script.
Try using a different script. Use this command line in the script here: