visual-studio 在 WiX 脚本中执行命令行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2313545/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Execute Command Line In WiX Script?
提问by Todd Ropog
How can I execute a command line from within a WiX script?
如何从 WiX 脚本中执行命令行?
I want to dynamically generate a command line string and have it executed. I'm not installing a file related to this.
我想动态生成一个命令行字符串并执行它。我没有安装与此相关的文件。
Using version 3.0.5419.
使用版本 3.0.5419。
回答by JohnL
What you probably want is something like this (observing quotes where necessary in the command):
你可能想要的是这样的(在命令中必要的地方观察引号):
<CustomAction Id='ExecNotepad' Directory='INSTALLDIR' Execute='immediate'
ExeCommand='[SystemFolder]notepad.exe "[SOMEFILE]"' Return='ignore'/>
The ExeCommand is where you want to put your command. Here I have notepad launching with a file. Some of the attributes will be different, depending on what your command does - particularly the Execute and Impersonate parameters. It would also be helpful to know what version of WiX you were using (the code above is v2).
ExeCommand 是您要放置命令的位置。在这里,我用记事本启动了一个文件。某些属性会有所不同,具体取决于您的命令的作用 - 特别是 Execute 和 Impersonate 参数。了解您使用的 WiX 版本(上面的代码是 v2)也会很有帮助。

