How to add arguments to the custom action exe in W

2019-08-03 23:25发布

问题:

I am trying to execute an exe after installation. Below is how I am trying to do this.

 <Property Id="WixShellExecTarget" Value="[#fil7D28AEF774656849395A2FA20A5C963D]" />
    <CustomAction Id="LaunchMosquitto" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />

    <InstallExecuteSequence>
      <Custom Action="LaunchMosquitto" After="InstallFinalize" />
    </InstallExecuteSequence>

In here, [#fil7D28AEF774656849395A2FA20A5C963D] refers to the file ID. I need to run this exe with the parameter " -c config.conf". How can I achieve this? Any help would be much appreciated. I need this to happen without a command prompt being launched.

Logs after the answer :

MSI (s) (D0:24) [18:32:16:273]: Executing op:  ActionStart(Name=LaunchMosquitto,,)
MSI (s) (D0:24) [18:32:16:273]: Executing op:  CustomActionSchedule(Action=LaunchMosquitto,ActionType=3137,Source=BinaryData,Ta rget=WixQuietExec64,CustomActionData="C:\Kube2.0\Mosquitto\mosquitto.exe" -c  C:\Kube2.0\Mosquitto\mosquitto.conf)

回答1:

As Yan suggested you should use a quiet CA.

<SetProperty Id="LaunchMosquitto" Value="&quot;[#fil7D28AEF774656849395A2FA20A5C963D]&quot; -c config.conf" Before="LaunchMosquitto" Sequence="execute"/>
<CustomAction Id="LaunchMosquitto"
              BinaryKey="WixCA"
              DllEntry="WixQuietExec64"
              Execute="deferred"
              Return="check"
              Impersonate="no"/>

<InstallExecuteSequence>
  <Custom Action="LaunchMosquitto" Before="InstallFinalize" />
</InstallExecuteSequence>