WiX:安装后如何执行命令行命令 [英] WiX: How to execute a command line command after installation

查看:96
本文介绍了WiX:安装后如何执行命令行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装后,我需要注册一个HTTP端口,但是我想这可以抽象为通常执行任何命令行命令的方法。这是到目前为止我得到的:

I need to register an HTTP port after installation, but I guess this could be abstracted to generally executing any command line command. Here's what I've got so far:

<CustomAction Id="ExecPortOpen" Directory="INSTALLFOLDER" Execute="immediate" ExeCommand="cmd.exe &quot;netsh http add urlacl url=http://+:1234/ user=Everyone&quot;" Return="ignore" />
<InstallExecuteSequence>
<Custom Action="ExecPortOpen" After="InstallFinalize" />
</InstallExecuteSequence>

这只是在安装过程中打开一个命令提示符,对此不执行任何操作。我尝试在cmd.exe和命令之间添加/ c(我不知道它的作用),但这只是在不执行命令的情况下打开和关闭命令提示符。我该如何工作?我正在使用WiX 3.8。

This just opens a command prompt mid-install and does nothing with it. I've tried adding /c (I have no idea what it does) inbetween cmd.exe and the command but that just opens and closes the command prompt without executing the command. How do I make this work? I'm using WiX 3.8.

推荐答案

解决了我自己,实际上是一个UAC /权限问题。对于任何感兴趣的各方,这里都是工作代码:

Solved myself, was actually an UAC/ permissions issue. For any interested parties here is the working code:

<CustomAction Id="ExecPortOpen" Directory="INSTALLFOLDER" Execute="commit" Impersonate="no" ExeCommand="cmd.exe /c &quot;netsh http add urlacl url=http://+:1234/ user=Everyone&quot;" Return="check" />

<InstallExecuteSequence>
  <Custom Action="ExecPortOpen" After="InstallInitialize" />
</InstallExecuteSequence>

这篇关于WiX:安装后如何执行命令行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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