BruceG
23rd May 2008 18:18 UTC
makensis /D with spaces in value
I am doing this:
"c:\Program Files\NSIS\makensis.exe" "D:\Devroot\\nsis\0 IMGSETUP.nsi" /V2 /X"SetCompressor /SOLID /FINAL lzma" /DDESTPATH=D:\Devroot\Myfolder with spaces\
in a batch file. If the path given in /D has no spaces, i.e. /DDESTPATH=mypath then it works. But with spaces, I can't get it to work.
I have tried /D"X=Y Z", "/DX=Y Z", /DX="Y Z", all of these with single quotes, and get various errors.
Help!
Red Wine
23rd May 2008 18:34 UTC
@echo off
set makensis=C:\PROGRA~1\NSIS\makensis.exe
set def=/DX="A B Y Z"
set script=myscript.nsi
%makensis% %def% %script%
Anders
23rd May 2008 18:35 UTC
Parameters are processed by order. makensis /Ddef script.nsi is not the same as makensis script.nsi /Ddef.
makensis "/Dx=foo bar" temp.nsi works fine for me
BruceG
23rd May 2008 18:52 UTC
Red Wine: Actually I am running from within my build system, not actually using a batch file. I made a batch to illustrate the problem, so I can't do the set commands like you suggested.
Anders: I am running an older version of nsis, so if it appears to work now, I can upgrade. I was hoping it was a syntax error in how I was doing the /D.
BruceG
24th May 2008 06:37 UTC
Found the problem. I just noticed now that the example I posted had the parameters in the wrong order, though my actual situation had it correct (/D before the script name).
The double quotes around the whole /D was the correct way to go. Problem was that passing a path with a trailing backslash would end up escaping the trailing double quote, so it would not properly extract the arg. e.g. "/Dx=C:\x y\"
Ensuring there is no trailing double quote (and adding one within the script where the defined variable is used) fixed it!
Thanks for looking at this and verifying what I wanted to do would work.