如何在wix的自定义操作中隐藏控制台? [英] How to hide console in custom action of wix?

查看:22
本文介绍了如何在wix的自定义操作中隐藏控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为follower的项目代码部分:

The part of project's code as followers:

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="SetupProjectConsole" />
        </Directory>
    </Directory>
</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
  <Component Id="product" Guid="69513FD8-F65A-420F-8FE8-D456890DB457">
       <File Id="Run.bat" Name="Run.bat" Source="Resource\Run.bat"></File>
  </Component>
 </ComponentGroup>
<Property Id="QtExecDeferredExample" Value="&quot;[INSTALLFOLDER]Run.bat&quot;"/>
<CustomAction Id="QtExecDeferredExample" BinaryKey="WixCA" DllEntry="CAQuietExec"     Execute="deferred" Return="check" Impersonate="no"/>
<InstallExecuteSequence>
  <Custom Action="QtExecDeferredExample" After="InstallFiles"></Custom>
</InstallExecuteSequence>
</Fragment>

但是安装日志显示为关注者:

But the log of instlling showing as followers:

CAQuietExec:  Error 0x80070002: Command failed to execute.
CAQuietExec:  Error 0x80070002: CAQuietExec Failed
CustomAction QtExecDeferredExample returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 11:57:17: InstallFinalize. Return value 3.

但是如果我将 [INSTALLFOLDER] 替换为 C:\Program Files (x86)\SetupProjectConsole\,安装程序不会显示任何错误.我该如何处理这个问题?谢谢!

but if i replace the [INSTALLFOLDER] with C:\Program Files (x86)\SetupProjectConsole\, the installer does not show any error. How do I deal with this problem? Thanks!

推荐答案

批处理文件不是可执行文件.批处理文件是由 cmd.exe 解释的文本文件.QtExec 自定义操作仅运行可执行文件,因此您需要调用解释器.

Batch files are not executables. Batch files are text files that are interpreted by cmd.exe. The QtExec custom action only runs executables so you need to call the interpreter.

类似以下的内容应该会更好:

Something like the following should work better:

<Property Id="QtExecDeferredExample" Value="[SytemFolder]cmd.exe /k &quot;[INSTALLFOLDER]Run.bat&quot;"/>

但是,调用批处理文件并不是可靠安装的标志.

However, calling batch files isn't a hallmark of a robust installation.

这篇关于如何在wix的自定义操作中隐藏控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆