Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup parameter with quotes in [Run] section

I use [Run] section to modify the merit value of some codecs with commandmerit.exe that supports command-line.

So the syntax is:

Commandmerit.exe "{E2B7DF46-38C5-11D5-91F6-00104BDB8FF9}" "0x800000"  

{E2B7DF46-38C5-11D5-91F6-00104BDB8FF9} is the CLSID of the codec and 0x800000 is the value of the new merit, but when I put this line in [Run] section :

Filename: "{app}\Commandmerit.exe"; Parameters: ""{F8FC6C1F-DE81-41A8-90FF-0316FDD439FD}" "0x10000000""; WorkingDir: "{app}"

The flowing error is displayed:

Mismatched or misplaced quotes on parameter.

If I put this line:

Filename: "{app}\Commandmerit.exe"; Parameters: """{F8FC6C1F-DE81-41A8-90FF-0316FDD439FD}" "0x10000000"""; WorkingDir: "{app}"

The flowing error is displayed :

Unknown constant ...... use two consecutive"{" if .....

If I put this line:

Filename: "{app}\Commandmerit.exe"; Parameters: """{{F8FC6C1F-DE81-41A8-90FF-0316FDD439FD}}" "0x10000000"""; WorkingDir: "{app}"

Then no error is displayed but it seems that the commandmerite.exe don't understand the parameter, so after the installer finishes the merit still unchanged.

like image 730
david cooper Avatar asked Apr 04 '13 20:04

david cooper


2 Answers

To add quotes to a parameter, you must double up each quote, and then put quotes around the entire value.

Your second attempt was close but you forgot the middle ones.

Filename: "{app}\Commandmerit.exe"; Parameters: """{F8FC6C1F-DE81-41A8-90FF-0316FDD439FD}"" ""0x10000000"""; WorkingDir: "{app}"
like image 124
Deanna Avatar answered Nov 01 '22 05:11

Deanna


I can see two different things in your problem.

First, is the { having a special meaning in inno setup, because it is the start of a constant. So, you have to escape the { by doubling it, e.g. {{. There is no need to escape the closing bracket because it is treated as the end of a constant only if it is a start for that constant.

Second, is that you're trying to pass " as part of the string, but that seems unnecessary in this case, since the purpose of the " character in the command line parameters is to allow the use of blank spaces inside a single parameter, but none of your parameters have spaces.

All that said, you must try writing your command like this:

[run]
Filename: "{app}\Commandmerit.exe"; Parameters: {{F8FC6C1F-DE81-41A8-90FF-0316FDD439FD} 0x10000000; WorkingDir: "{app}"
like image 24
jachguate Avatar answered Nov 01 '22 04:11

jachguate