且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 WiX 脚本中执行命令行?

更新时间:2023-02-22 10:23:39

你可能想要的是这样的(在命令中必要时观察引号):

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 &quot;[SOMEFILE]&quot;' Return='ignore'/>

ExeCommand 是您要放置命令的地方.在这里,我用一个文件启动了记事本.某些属性会有所不同,具体取决于您的命令的作用——尤其是 Execute 和 Impersonate 参数.了解您使用的 WiX 版本也很有帮助(上面的代码是 v2).

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).