Search code examples
cmdwixcustom-action

CMD window remain open after wix installation runs application


Using Wix installer (win 8), I have a custom action that runs the application after successful installation, using Wix:

       <CustomAction Id='LaunchFile'
        Directory='TARGETDIR'
        Impersonate="no"
        Execute="immediate"
        ExeCommand='[SystemFolder]cmd.exe start CMD /c ""[TARGETDIR]ManagerAndControl.exe""'
        Return="asyncNoWait" />

This works great, but for some reason, the CMD window remains open, and when the application is closed it is closed too.

I couldn't find anything similar in google, anyone encounterd a similar problem?

Thank you

EDIT:

I'm trying, as @Rolo suggested, the QtExecCmdLine:

  <Property Id="QtExecCmdLine" Value='C:\Users\User\Desktop\tests.exe'/>
  <CustomAction Id="QtExecExample" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate"    Return="check"/>

And also:

 <Publish Event='DoAction' Value='QtExecExample'>(NOT Installed) AND (LAUNCHPRODUCT = 1)
 </Publish>

But nothing happens, and the log says:

Action start 11:02:49: QtExecExample.
MSI (c) (E0:20) [11:02:49:911]: Invoking remote custom action. DLL:      C:\Users\User\AppData\Local\Temp\MSIAD42.tmp, Entrypoint: CAQuietExec
MSI (c) (E0:EC) [11:02:49:913]: Cloaking enabled.
MSI (c) (E0:EC) [11:02:49:913]: Attempting to enable all disabled privileges before calling       Install on Server
MSI (c) (E0:EC) [11:02:49:913]: Connected to service for CA interface.
MSI (c) (E0!00) [11:02:49:944]: PROPERTY CHANGE: Deleting QtExecCmdLine property. Its current     value is 'C:\Users\User\Desktop\tests.exe'.
Action ended 11:02:49: QtExecExample. Return value 3.
DEBUG: Error 2896:  Executing action QtExecExample failed.
The installer has encountered an unexpected error installing this package. This may indicate a    problem with this package. The error code is 2896. The arguments are: QtExecExample, , 
Action ended 11:02:49: FinishedForm. Return value 3.
Action ended 11:02:49: INSTALL. Return value 1.

Filling lost here


Solution

  • Thanks for your help, finally I solved it:

     <Property Id="WixShellExecTarget" Value='[TARGETDIR]ManagerAndControl.exe' />
     <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes"   />
    
     <!-- UI code here -->
    
     <Publish Event='DoAction' Value='LaunchApplication'>(NOT Installed) AND (LAUNCHPRODUCT = 1)</Publish>