inno setup parameter with quotes in [RUN] section

2019-04-18 22:38发布

I use [run] section to modify the merit value of some codecs with commandmerit.exe that support commandeline.

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 quates 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

标签: inno-setup
2条回答
Melony?
2楼-- · 2019-04-18 22:53

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}"
查看更多
smile是对你的礼貌
3楼-- · 2019-04-18 23:00

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}"
查看更多
登录 后发表回答