Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run/include batch file in installshield setup

I have created setup using installshield and everything is work file. Now I have one batch file and want to run with setup. I know we can create custom action and I have already created custom action for run powershell script and it is working fine.

Can anyone help/guide me for using which custom action I can execute the batch file?

Also I want to run MySQL script from installshield setup.

What I have tried:

I have tried to create different custom action but I don't know exactly which custom action is used for execute the batch file.

like image 568
Rajesh Pandya Avatar asked Nov 26 '25 17:11

Rajesh Pandya


1 Answers

ASSUMING AN MSI INSTALLATION:

In your MSI Installation Designer pane, click on "Custom Actions and Sequences"; in the top part of the middle pane right click on "Custom Actions" and choose "New EXE -> Stored in Binary Table". Give it a name (and description, if you like). When it saves, right-click it and start the Custom Action Wizard.

The Action Type should be "Launch an executable" and the Location should be "Stored in the Directory Table".

For Action Parameters "Source", choose the directory you want to start in. For target enter a command to invoke your script, like cmd /c .\RunMyScript.bat arg1 arg2 ... (assuming the script is in the directory you started in.) If the script is in a different folder you can put one of your directory variables in brackets: cmd /c [INSTALLDIR]bin\script.bat. Typically the directory variable will already include a trailing backslash; using these variables with the bracket syntax helps make sure the action works even if the user chooses a different installation folder.

If the script is in a folder that is not a required part of the installation, you may need to make your command be something like cmd /c if exist .\script.bat .\script.bat - so that the custom action does not fail if the feature containing your script is not selected for install (or is removed when an installation is modified.)

I have typically wanted execution to be synchronous (install waits until script finishes before moving on); if your script does not return a reliable exit code, or if you don't want the installation to abort if the script fails, choose the one with "(Ignores error code)".

The custom action should typically be in the InstallExec sequence, after files are installed (but a script you run during an uninstall or repair could run earlier or in a different sequence.)

like image 142
John Elion Avatar answered Nov 28 '25 07:11

John Elion