Inno Setup parameter with quotes in [Run] section

24

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.

configuration
inno-setup
asked on Stack Overflow Apr 4, 2013 by david cooper • edited Jan 16, 2020 by Martin Prikryl

2 Answers

40

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}"
answered on Stack Overflow Apr 5, 2013 by Deanna
5

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}"
answered on Stack Overflow Apr 4, 2013 by jachguate

User contributions licensed under CC BY-SA 3.0