How to run a _BAT file in InstallShield

 
http://blog.csdn.net/cyatzzu/article/details/1790240
 
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().

 

你可能感兴趣的:(How to run a _BAT file in InstallShield)