0

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.

Dbloom
  • 1,302
  • 3
  • 18
  • 45

2 Answers2

1

You escape them using a forwards \

like so

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

ref

  • So I used a config file with the ExecuteParameters line that looked like this: ExecuteParameters="-DeploymentType "\""Uninstall"\""". That produced a non-working .exe. When I tried to run it it said 'Config Failed.' – Dbloom Aug 12 '15 at 22:51
  • http://7zsfx.info/en/ taken from the reference manual, can u try ExecuteParameters="-DeploymentType \"Uninstall\"" for me pls –  Aug 12 '15 at 23:07
  • That is no longer causing an error when I run my .exe, but Deploy-Application.exe is acting like its ignoring the parameter. – Dbloom Aug 12 '15 at 23:17
  • That will allow the exe to run without error, but Deploy-Application.exe runs as if the -DeploymentType "Uninstall" parameter is not there. Basically, it runs in the default, Install mode. Not the Uninstall mode. I verified by running Deploy-Application.exe manually from CMD with the -DeploymentType "Uninstall" parameter DOES work as I expect. So it is something with the SFX module and the config file I'm not doing right. – Dbloom Aug 12 '15 at 23:23
  • Also, I am using the standard 7zSD.sfx module from LZMA SDK 15.05, not the modified module from http://7zsfx.info/en/ – Dbloom Aug 12 '15 at 23:24
  • you don't need the extra quotes then I think, try for me pls –  Aug 12 '15 at 23:26
  • What extra quotes? Can you give sample syntax? – Dbloom Aug 13 '15 at 00:05
  • ExecuteParameters="-DeploymentType Uninstall" –  Aug 13 '15 at 16:42
1

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" 
Dbloom
  • 1,302
  • 3
  • 18
  • 45