简体   繁体   English

wix安装运行应用程序后,CMD窗口保持打开状态

[英]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: 使用Wix安装程序(win 8),我有一个自定义操作,该操作将在成功安装后使用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. 这很好用,但是由于某种原因,CMD窗口保持打开状态,当应用程序关闭时,它也关闭。

I couldn't find anything similar in google, anyone encounterd a similar problem? 我在Google中找不到任何类似的东西,有人遇到过类似的问题吗?

Thank you 谢谢

EDIT: 编辑:

I'm trying, as @Rolo suggested, the QtExecCmdLine: 我正在按照@Rolo的建议尝试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 http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html

Update: 更新:

I'll have to update my answer. 我将不得不更新我的答案。 You should use the WixShellExec custom action. 您应该使用WixShellExec自定义操作。 It works pretty similar to Quiet Execution CA, but it will allow you to launch the app without waiting for it to close. 它的工作原理与Quiet Execution CA非常相似,但是它将允许您启动应用程序而无需等待其关闭。

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/howtos/ui_and_localization/run_program_after_install.html

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

Edit your execommand like this 像这样编辑您的execommand

> 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. 但是,在具有[TARGETDIR]的位置,我使用[INSTALLDIR]-我认为这是在引用您的安装目录。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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