WiX:安装后如何执行命令行命令 [英] WiX: How to execute a command line command after installation
问题描述
安装后,我需要注册一个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 "netsh http add urlacl url=http://+:1234/ user=Everyone"" 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 "netsh http add urlacl url=http://+:1234/ user=Everyone"" Return="check" />
<InstallExecuteSequence>
<Custom Action="ExecPortOpen" After="InstallInitialize" />
</InstallExecuteSequence>
这篇关于WiX:安装后如何执行命令行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!