我实现了wix来生成一些msi。我想维护.bat文件(包含在这个wix项目中)以包含一些工作要做(并通过一些自定义操作激活) 我将.bet添加到VS2010的wix项目中。
我的问题是
答案 0 :(得分:9)
这可能不是您正在寻找的答案,但我强烈建议您不要这样做。从MSI包中运行批处理文件有许多缺点,有一天会拍你:
相反,我鼓励您执行以下操作:
答案 1 :(得分:3)
您正在寻找我认为的type 18 custom action:
The executable is generated from a file installed with the application. The
Source field of the CustomAction table contains a key to the File table. The
location of the custom action code is determined by the resolution of the target
path for this file; therefore this custom action must be called after the file
has been installed and before it is removed.
CustomAction element具有ExeCommand属性,仅适用于此类场合。它看起来像这样:
<CustomAction Id="ExecuteMyBatchFile"
FileKey="[#FileKey]"
ExeCommand="Arguments passed to batch file"
Execute="deferred"/>
当然,这是假设msi安装了批处理文件。