简体   繁体   中英

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

Use the "Quiet Execution Custom Action" instead.

http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html

Update:

I'll have to update my answer. You should use the WixShellExec custom action. It works pretty similar to Quiet Execution CA, but it will allow you to launch the app without waiting for it to close.

However it can only be used as an immediate custom action.

There is a full example of the implementation you need here:

http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html

http://wixtoolset.org/documentation/manual/v3/customactions/shellexec.html

Edit your execommand like this

> ExeCommand='[SystemFolder]cmd.exe start CMD /c ""[TARGETDIR]ManagerAndControl.exe"" &amp; exit'

EDIT

> ExeCommand='"[TARGETDIR]ManagerAndControl.exe"'

I've just tried this for me and it's worked after I recreated your original problem. However, where you have [TARGETDIR] I use [INSTALLDIR] - I assumed that this was referencing your install directory. You need to be aware of your use of inverted commas.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM