run script of batch file from within WIX

use*_*852 1 windows-installer wix wix3.5

I implement wix to generate some msi. I'd like to maintain .bat file (that is packed within this wix project) to contain some work to do (and to be activated with some custom action) I added the .bet to my wix project in VS2010.

My question is

  1. how do I actually wrap it within the msi that on target machine the script will be available to run?
  2. How do I actually refer to that embedded batch file in the custom section element

Yan*_*nko 9

这可能不是您正在寻找的答案,但我强烈建议您不要这样做.从MSI包内部运行批处理文件有许多缺点,有一天会拍摄你:

  • 防病毒软件可能会阻止执行
  • 对于任何延迟的自定义操作(更改目标系统状态的操作),您将必须创建回滚操作,对于可能包含多个不同性质的步骤的批处理文件,可能会更加困难
  • 你没有进展(我怀疑这对批处理脚本来说是完全可能的)

相反,我鼓励您执行以下操作:

  • 分析您的批处理脚本,并列出它对目标系统所做的确切事情
  • 看看标准的Windows Installer功能和WiX扩展,看看有什么开箱即用
  • 设计您的安装尽可能使用标准功能和尽可能少的自定义操作
  • 如果您仍需要自定义操作,请坚持使用自定义操作,并确保存在针对延迟操作的回滚操作