MarkA
13th February 2005 16:14 UTC
$INSTDIR with spaces causes problems as a parameter
Hi,
I am trying to run a program at the end of an instalation, for example
!define MUI_FINISHPAGE_RUN "$INSTDIR\MyProgram.exe"
and pass it the instalation directory as a parameter
!define MUI_FINISHPAGE_RUN_PARAMETERS "$INSTDIR"
However when MyProgram.exe runs it only gets C:\Program instead of the entire path.
Now, I figure, okay I need to add quotes around $INSTDIR, so I change it to this...
!define MUI_FINISHPAGE_RUN_PARAMETERS '"$INSTDIR"'
but now MyProgram.exe does not even get executed at the end of installation.
What is the solution to this? I can't see any other way around it. I don't wanna have to go back to using msi :(
Mark
pengyou
13th February 2005 18:16 UTC
When I tried a simple example it worked OK, and the program started by the installer found the correct value for $INSTDIR even if it contained spaces.
Perhaps the problem is that the program you are running stops reading the command-line parameter when it finds a space, so you need to enclose the parameter in quotes?
If you use
!define MUI_FINISHPAGE_RUN_PARAMETERS $\"$INSTDIR$\"
and use C:\Program Files\My Demo for the installation then your program should find the command-line contains
"C:\Program Files\My Demo"
instead of just
C:\Program Files\My Demo
MarkA
14th February 2005 09:32 UTC
hmm i am using HM NISEdit as my environment around nsis. Is this known to have this type of issue?
I will try escaping the quotes as per your example. Thanks.
Brummelchen
14th February 2005 14:24 UTC
In worst case use GetShortName (nsis function) and have a 8 character limit ;)
>> C:\Program Files\My Demo
becomes
C:\Progra~1\MyDemo~1
8.3 is recommended while using Exec with dosbox programs (like RAR.EXE or 7ZA.EXE)
MarkA
14th February 2005 14:58 UTC
sneaky idea mate :D
Brummelchen
15th February 2005 22:20 UTC
Sorry, must be "GetFullPathName /SHORT user_var(output) path_or_file"
http://forums.winamp.com/showthread....hreadid=207857