首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行应用程序后,CMD窗口将保持打开状态。

运行应用程序后,CMD窗口将保持打开状态。
EN

Stack Overflow用户
提问于 2014-11-20 15:23:39
回答 2查看 1.5K关注 0票数 0

使用Wix安装程序(win 8),我有一个自定义操作,在成功安装后运行应用程序,使用Wix:

代码语言:javascript
复制
       <CustomAction Id='LaunchFile'
        Directory='TARGETDIR'
        Impersonate="no"
        Execute="immediate"
        ExeCommand='[SystemFolder]cmd.exe start CMD /c ""[TARGETDIR]ManagerAndControl.exe""'
        Return="asyncNoWait" />

这很好用,但是由于某种原因,CMD窗口仍然是打开的,当应用程序关闭时,它也会关闭。

我在谷歌找不到类似的东西,有人遇到过类似的问题吗?

谢谢

编辑:

我正在尝试,就像@Rolo建议的那样,QtExecCmdLine:

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

还包括:

代码语言:javascript
复制
 <Publish Event='DoAction' Value='QtExecExample'>(NOT Installed) AND (LAUNCHPRODUCT = 1)
 </Publish>

但什么都没发生,日志上写着:

代码语言:javascript
复制
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.

填补丢失在这里

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-11-24 07:26:07

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

代码语言:javascript
复制
 <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>
票数 1
EN

Stack Overflow用户

发布于 2014-11-20 16:01:35

使用“安静的执行自定义操作”代替。

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

更新:

我得更新我的答案。您应该使用WixShellExec自定义操作。它的工作原理非常类似于安静执行CA,但它将允许您启动应用程序,而不等待它关闭。

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

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

install.html

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

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27043190

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档