4

from a Wix installer package I am starting one of the installed programs at the end of the setup, according to http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html:

<Property Id="WixShellExecTarget" Value="[#myapplication.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />

I now need to include a switch ("/X") to start the program with and failed to find out how to do that (adding it to Value disables the start of the program alltogehter) - any advice? Thanks!

LeRookie
  • 311
  • 3
  • 12

1 Answers1

4

WixShellExecTarget must be only the path of the executable/document. There's no support to add arguments. For that, use a "normal" exe custom action instead of WixShellExec.

Because a more typical use case is to launch a document (like a readme.html or .pdf). WixShellExec was designed just for that purpose.

http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Passing-command-line-arguments-to-an-app-launched-after-setup-td1366362.html


You could replace your custom action with something like:

<CustomAction Id="LaunchApplication" 
     Impersonate="yes" 
     FileKey="[Id for File element that was installed]"
     ExeCommand="/X" 
     Return="asyncNoWait" />

I guessed on some of the attributes that you'd want, but you could use the Wix CustomAction element reference page for more information. I think you want custom action type 18 (to run an executable copied during this installation), so this example should help as well.

Community
  • 1
  • 1
jjj
  • 4,822
  • 1
  • 16
  • 39
  • jjj answer is a life saver. I spent two days trying to figure out how to launch an application with command line parameters after the installation. No other technique worked (WixShellExec, etc.), only this one. – Terry Jul 25 '21 at 04:13