How can I create a 7-zip SFX installer that has double quotes in the parameter string?

1.8k views Asked by At

I need to create an installer that runs a file called Deploy-Application.exe. Deploy-Application.exe takes a parameter that looks like this:

Deploy-Application.exe -DeploymentType "Uninstall"

When I put that in my config file, it doesn't work, because the Sfx module thinks my parameter is just

-DeploymentType 

Because of the double quote. Is there an excape character for a double quote for the 7-zip SFX module? If there is I cannot find it!

Here is my config file:

;!@Install@!UTF-8!
Title="test"
Progress="No"
ExecuteParameters="-DeploymentType "Uninstall""
RunProgram="Deploy-Application.exe"
;!@InstallEnd@!

EDIT: It turns out that Deploy-Application.exe does not need quotes around the parameters. I just tested this by running it via cmd, like this:

Deploy-Application.exe -DeploymentType Uninstall

and it worked fine. However, when I have a config file that looks like this:

;!@Install@!UTF-8!
Title="test"
Progress="No"
ExecuteParameters="-DeploymentType Uninstall"
RunProgram="Deploy-Application.exe"
;!@InstallEnd@!

it still does not work. The parameters are ignored, which I verified with ProcessExplorer, and Deploy-Application.exe launches with no parameters.

2

There are 2 answers

8
AudioBubble On

You escape them using a forwards \

like so

"\""  --> "
EG: ExecuteParameters="-DeploymentType \"Uninstall\""

ref

0
Dbloom On

Well, it turns out it had nothing to do with quotes or anything. After reading the installer.txt document that comes with the LZMA SDK for the 100th time, I realized that 'ExecuteParameters' does not work with 'RunProgram', it only works with 'ExecuteFile'.

Here is how you use parameters for 'Run Program'

RunProgram="notepad.exe"
RunProgram="C:\\Windows\\system32\\notepad.exe"
RunProgram="%Path%\\notepad.exe"
RunProgram="fm0:nowait:7z_EN.chm"
RunProgram="\"%%T\\Reader7Rus.msi\" /qn"
RunProgram="hidcon:fm0:\"%%S\\install.cmd\" /Q"

From the documentation, which I did not read carefully enough:

ID_String          Description 

Title              Title for messages 
BeginPrompt        Begin Prompt message 
Progress           Value can be "yes" or "no". Default value is "yes". 
RunProgram         Command for executing. Default value is "setup.exe". 
                   Substring %%T will be replaced with path to temporary 
                   folder, where files were extracted 
Directory          Directory prefix for "RunProgram". Default value is ".\\" 
ExecuteFile        Name of file for executing 
ExecuteParameters  Parameters for "ExecuteFile"