Skip to content
⌘ NSIS Forum Archive

InstallDir with Spaces

6 posts

cupid062985#

InstallDir with Spaces

Hi Guys,

I need some help here.

I try to install an exe file with the following line:


ExecWait "$\"$TEMP\setup.exe$\" /v$\" /norestart /qb INSTALLDIR=$\"C:\Program Files\Folder$\""
but it failed because of the Space.

I was wondering why for MSI packages it work.


ExecWait "msiexec /i $\"$TEMP\setup.msi$\" /quiet /passive /norestart INSTALLDIR=$\"C:\Program Files\Folder$\""
Please help me. I need some light.

Thanks a lot in advance.
MSG#
You have one too many quotes in your command:
ExecWait "$\"$TEMP\setup.exe$\" /v$\" /norestart /qb INSTALLDIR=$\"C:\Program Files\Folder$\""
Should be
ExecWait "$\"$TEMP\setup.exe$\" /v /norestart /qb INSTALLDIR=$\"C:\Program Files\Folder$\""

But next time, please use ` or ' quotes to prevent trouble like this. It also makes your code much more readable:

ExecWait `"$TEMP\setup.exe" /v /norestart /qb INSTALLDIR="C:\Program Files\Folder"`
cupid062985#
I want to achieve this command line:


setup.exe /v" /norestart /qb INSTALLDIR="C:\Program Files\Folder"
I believe it's not the quotation because if I manually input the following command:


setup.exe /v" /norestart /qb INSTALLDIR="C:\Test"
it will work. I believe $\" is the way of escaping ".

It must have something to do with the space i think... because I coded it the way like the one I posted. Anyways I will try your suggestion.

Thanks a lot... 🙂
Afrow UK#
As MSG said above, use ' or `:
ExecWait `"$PLUGINSDIR\setup.exe" /v" /norestart /qb INSTALLDIR="C:\Program Files\Folder"`
Also don't use relative paths.

Stu
MSG#
Originally Posted by cupid062985 View Post
I believe it's not the quotation because if I manually input the following command:


setup.exe /v" /norestart /qb INSTALLDIR="C:\Test"
it will work.
I think that's a very scary command... I'm not sure how those parameters will be passed to setup.exe. My guess would be that setup recieves only two parameters, namely `/v" /norestart /qb INSTALLDIR="` as the first parameter and `C:\Test"` as the second. This would mean that with a space in the path, it would receive something like `/v" /norestart /qb INSTALLDIR="` as the first parameter, `C:\Program` as the second, and `Files\Folder"` as the third. If that's the case, then it depends entirely on how setup.exe parses its own parameters...

Is there a way to prevent the /v" parameter?
cupid062985#
@MSG

the sample is just in the command line. thus it is a relative path...

@Afrow

I already tried the one suggested but it only works on InstallDir with no space. I even changed /v" to /v still the same...

🙁