繁体   English   中英

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

[英]CMD window remain open after wix installation runs application

使用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" />

这很好用,但是由于某种原因,CMD窗口保持打开状态,当应用程序关闭时,它也关闭。

我在Google中找不到任何类似的东西,有人遇到过类似的问题吗?

谢谢

编辑:

我正在按照@Rolo的建议尝试QtExecCmdLine:

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

并且:

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

但是什么也没发生,日志显示:

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.

填充在这里迷路了

而是使用“安静执行自定义操作”。

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

更新:

我将不得不更新我的答案。 您应该使用WixShellExec自定义操作。 它的工作原理与Quiet Execution CA非常相似,但是它将允许您启动应用程序而无需等待其关闭。

但是,它只能用作立即的自定义操作。

这里有您需要的完整实现示例:

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

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

像这样编辑您的execommand

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

编辑

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

我刚刚为我尝试过此方法,并且在重新创建了您原来的问题后,该方法才起作用。 但是,在具有[TARGETDIR]的位置,我使用[INSTALLDIR]-我认为这是在引用您的安装目录。 您需要注意对逗号的使用。

感谢您的帮助,终于我解决了:

 <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