How to run a _BAT file in InstallShield

 
 
InstallShield做的安装包可以执行exe、vbs脚本、js脚本,就是不能执行bat??找这个答案半天。
 
终于在官方论坛找到了比较perfect的答案。cmd.exe /c batfilename.bat , 咋就没想到呢。
 
老外的说明很详细了,不多说了,Ctrl+C,Ctrl+V。 
 

1. In the "Custom Actions" view, right click "Custom Actions" and select "Custom Action Wizard."

2. Set a name for the CA.
Click "Next."

3. Type: Launch an executable
Location: Stored in Directory Table
Click "Next."

4 Source: Select SystemFolder
Target: [SystemFolder]cmd.exe
you'll modify this in just a bit...
Click "Next."

5. Check "Wait..."
Click "Next."

6. In-Script Execution: try Deferred, but you may need to make that "Deferred In System Context" if you get permissions-related errors.
Click "Next."

7. Install UI Interface (<Absent..>)
Install Execute Sequence: sometime after "InstallFiles"

8. Okay, now take the directory table entry pointing to the install location of your batch file, let's say it's [MY_BIN], and let's say your batch file is called "MyBatch.bat". In the "Filename and Commandline" property of your new custom action (which currently says "[Systemfolder]cmd.exe") append the following: /c "[MY_BIN]MyBatch.bat"

That's just one solution. It's probably not recommended, but then again, neither is the use of batch files.

Alternatively, you could script a CA which essentially does the same thing using LaunchAppAndWait().

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值