- NSIS Discussion
- Problems passing parameters using ExecWait
Archive: Problems passing parameters using ExecWait
fmbulah
8th June 2009 19:18 UTC
Problems passing parameters using ExecWait
Hello,
I am trying to launch the JRE installer using ExecWait and pass in the installation directory to install to a specific directory inside the installation:
File "jre-1_5_0_10-windows-i586-p.exe"
ExecWait '"$OUTDIR\jre-1_5_0_10-windows-i586-p.exe" INSTALLDIR=$INSTDIR\jre'
It fails and brings up the Windows Installer error dialog which at the top says
"msiexec /Option <Required Parameter> [Optional Parameter]"
I suspect this is happening because it somehow is not recognizing the INSTALLDIR parameter.
I've tried enclosing the entire parameter string in quotes and enclosing just the value ($INSTDIR\jre) in quotes and neither works.
It works if I run it from a Windows command prompt.
If I leave the parameter off of the ExecWait it works but installs to the default location unless you do a 'Custom' install which is what I am trying to avoid.
Any and all ideas would be welcome and very much appreciated.
Thanks in advance.
Fred
fbulah@progress.com
Afrow UK
8th June 2009 19:25 UTC
What if $INSTDIR has spaces in it? You should put double quotes around your command line parameter as well.
Stu
fmbulah
8th June 2009 19:40 UTC
Hi Stu,
Thanks for the reply. As I described in the message, I tried putting quotes around $INSTDIR and also tried putting quotes around INSTALLDIR=$INSTDIR\jre neither of which worked. I tried putting quotes just around $INSTDIR and that also did not work.
I'm just about ready to pull what little hair I have left out. :)
Afrow UK
8th June 2009 21:28 UTC
Ah sorry for missing that. Maybe this will help you:
http://java.sun.com/j2se/1.4.2/docs/...de/silent.html
Stu
fmbulah
8th June 2009 22:43 UTC
Thanks for the pointer. I think I've tried every permutation ... except the right one. :)
Here's what I have now:
ExecWait '"$OUTDIR\jre-1_5_0_10-windows-i586-p.exe" /s /v "/qn ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 INSTALLDIR=$INSTDIR\jre /L $INSTDIR\jre.log"' $0
There is even an inconsistency in the instructions (surprise?): at the top it says to use /s /sv /qn " ... " while later on it says to use /s /v "/qn ... "
Tried both ways but still to no avail ... going to give it one more shot.
Ugggh!!
jpderuiter
8th June 2009 23:55 UTC
As stated in the first note on the java page mentioned by Afrow UK no space should be used between /v and the quote since you install it as a "Windows Offline Installation".
JP
fmbulah
9th June 2009 00:35 UTC
Thanks for the response JP. As I described, I tried all permutations both with and without the space. I'll try once more just to make sure there was no cockpit error on my part.
jpderuiter
9th June 2009 07:30 UTC
There are actually a couple of posts about installing jre.
You should use an escape character before the quotes in the parameter, so that the parser keeps them ($\" instead of "):
ExecWait '"$OUTDIR\jre-1_5_0_10-windows-i586-p.exe" /s /v$\"/qn ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 INSTALLDIR=$INSTDIR\jre /L $INSTDIR\jre.log$\"' $0
Why are you using an outdated version anyway?
JRE is at Version 6 Update 13 now.
http://www.java.com/en/download/manual.jsp
fmbulah
9th June 2009 15:16 UTC
Thanks for pointing out the need for an escape sequence ... good observation. I knew it would come down to something simple and somehow this did not dawn on me.
Unfortunately the bad news is that I cut-and-pasted this exactly and it still did not work. It seemed to take a bit longer before ultimately displaying the Windows Installer error dialog, however. Needless to say this is incredibly frustrating because I thought this was it.
NB: The return code - value of $0 - is 1639. I should have mentioned this before. I Google'd this but haven't found anything yet. Does this ring a bell?
NB2: This installer is for a specific project for one of our customers that uses an older version of our software (Progress Apama) with 1.5_10.
jpderuiter
9th June 2009 17:57 UTC
OK, so msiexec doesn't like spaces in it's parameters.
I wasn't able to work around this by using quotes.
But I got it working using the short "DOS" version of a path, like c:\progra~1:
File "jre-1_5_0_10-windows-i586-p.exe"
GetFullPathName /SHORT $0 $INSTDIR
ExecWait '"$OUTDIR\jre-1_5_0_10-windows-i586-p.exe" /s /v$\"/qn ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 INSTALLDIR=$0\jre /L $0\jre.log$\"' $1
Not sure if it works on Vista though...
Else you have to install it to a path without spaces...
JP
fmbulah
9th June 2009 18:34 UTC
Eureka ... this worked! Now I don't have to jump out the MS Window. :)
Thanks a ton ... your help is truly appreciated and your perseverance is to be commended.
With apologies to all MS devotees out there, MS continues to be the bane of our existence well into the 21st Century. :)
jpderuiter
9th June 2009 19:20 UTC
You're welcome, I'm glad I could help.
BTW, I forgot to search for the obvious thing: an escape character for msiexec.
It appears to be \".
Well, for NSIS this results in \$\".
Now the full line would become:
ExecWait '"$OUTDIR\jre-1_5_0_10-windows-i586-p.exe" /s /v$\"/qn ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 INSTALLDIR=\$\"$INSTDIR\jre\$\" /L \$\"$INSTDIR\jre.log\$\"$\"' $0
It works, but really hard to read.
The choice is yours ;-)
fmbulah
9th June 2009 23:40 UTC
Thanks again and duly noted.
But I think I may just quit while I'm ahead at this point. :)