关闭

How to run a .BAT file in InstallShield?

2550人阅读 评论(1) 收藏 举报
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().
 
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:18096次
    • 积分:298
    • 等级:
    • 排名:千里之外
    • 原创:11篇
    • 转载:0篇
    • 译文:0篇
    • 评论:3条
    文章存档
    最新评论