Reputation: 811
ExecWait "msiexec /i myinstaller.msi /qn" $0
That's all I'm calling in my script. (The /qn
is for silent installation without popping up any progress window, I've also tested without it).
It fails with an msiexec error code of 1619-This installation package could not be
opened. Verify that the package exists and
that you can access it, or contact the
application vendor to verify that this is
a valid Windows Installer package.
The same msiexec call works fine on the commandline, or if I write a basic NSIS script that does nothing else- which means it's not because of NTFS permissions that a Google search throws up.
Therefore, it must be something else in my main installer script. After commenting out nearly everything in my script to isolate the cause:
SetOutPath "$INSTDIR\Some directory"
If I comment this section out and don't set an output path, everything works fine. What on earth is going on? Why should this interfere with the msiexec call?
Update - Here's the tl;dr
version of the problem - the following snippet doesn't work when run as an independent script unless I comment out the SetOutPath
call. WHY?
It does not matter whether the output directory has any files in it or not(it doesn't), or whether I call it immediately before or several lines before.
showinstdetails show
OutFile test.exe
section
setoutpath "D:\back"
ExecWait "msiexec /i MyInstaller.msi /qr" $0
MessageBox MB_OK $0
sectionend
Upvotes: 2
Views: 10261
Reputation: 811
Found out what was wrong, with partial help from Nick and Anders above.
In my other script which worked, I was calling SetOutPath
after invoking the MSI.
Changing the sequence worked.
So lesson learned - relative paths get screwed up after calling SetOutPath
, so in my original example, the path to the msi would be resolved against what was set in 'SetOutPath
instead of using the current directory, where the installer is located.
Thanks guys!
Upvotes: 1
Reputation: 101756
SetOutPath sets the current/working directory for the process. (So using it will affect any relative paths later in the script)
You should always use full paths when possible and with correct quotes:
ExecWait 'msiexec /i "$exedir\myinstaller.msi" /qn' $0
(Replace $exedir with the correct path if necessary)
Upvotes: 1
Reputation: 19817
Try to use $PLUGINSDIR
directory and place myinstaller.msi
there. It is temp folder which will be deleted automatically after installer exited.
InitPluginsDir
File /oname=$PLUGINSDIR\myinstaller.msi "myinstaller.msi"
Then full path to myinstaller.msi
should be used in the ExecWait
.
Upvotes: 0
Reputation: 2113
There could be two things wrong here. The msi should really be in quotes, and you should really be giving the full path to that msi. The first is important if you include a path with spaces in; the second is important as msiexec.exe needs to know where that msi is - it may well not be in the system path.
Something like this should work (if the installer is in the %TEMP% folder):
ExecWait 'msiexec /i "$TEMP\myinstaller.msi" /qn'
Upvotes: 2