Page 1 of 1

Trouble with CMDLINE and spaces in parameters

Posted: Thu Nov 20, 2008 3:39 pm
by ZviZemel
Hello,

I've build a compressed .exe installer and I've wrapped it in a group policy MSI. I need to pass values in from the MSI on the command line to the exe, such as $TARGETDIR$. I know I can set CMDLINE to contain these parameters, but I can't make it work when the parameter values have spaces.

In this thread (http://www.installaware.com/forum/viewt ... dline#4302) it looks like I should use:

setup.msi CMDLINE='"PARAM1=pre post"' but in this case I just get a windows installer dialog popping up that tells me what the command line options are for msiexec. It clearly doesn't like parsing my line.

Any advice on how to properly pass parameters in CMDLINE with spaces in the values would be extremely helpful

Thanks
Zvi

Posted: Thu Nov 20, 2008 7:34 pm
by CandiceJones
Add /i and that will help.

Posted: Fri Nov 21, 2008 10:27 am
by ZviZemel
Hi Candice,

thanks for the reply. I have been using /i, but forgot to include it above in my original post. Sorry for that.

The original question still stands. I'm really not clear on how group policy MSIs can be used to pass parameters to the exe installer with spaces in the values.

Edit: Sorry, I should have said that when I use the /i option it is with msiexec, as in:
msiexec /i setup.msi CMDLINE='PARAM="my value"'


Thanks
Zvi

Posted: Fri Nov 21, 2008 2:29 pm
by ZviZemel
An update:

sometimes I *am* able to get the msi to launch with the command line specified above. I'm not clear on why this sometimes works and sometimes doesn't, or maybe I'm just making a silly mistake.

In any case, when it does launch with the above command line, the value for the variable does not get set.

I'm really not sure if this functionality to push variables through to the exe is broken or not.

Thanks
Zvi

Posted: Mon Dec 08, 2008 3:44 pm
by ZviZemel
If anyone is curious, the way around my problem is to escape a double-quote in the value of CMDLINE with a double-quote.

So if you need to call the MSI from the command line and pass parameters PARAM1 and PARAM2 to the setup.exe and the values of those parameters need to have spaces in them, you could do it like this:

setup.msi CMDLINE="PARAM1=""value with space"" PARAM2=""value with space"""

Note the three double-quotes at the end; two of them are to close off PARAM2 and the last one is to close off CMDLINE.

Hope this helps

Posted: Mon Dec 07, 2009 3:32 pm
by bmills42
ZviZemel wrote:If anyone is curious, the way around my problem is to escape a double-quote in the value of CMDLINE with a double-quote...

...Hope this helps
Thank you. It was very helpful.