execute .BAT file in installshield

user1906043 picture user1906043 · Dec 15, 2012 · Viewed 16.2k times · Source

I am developing a package and i need to run one .bat file that will install a windows service for me. I need 2 things:

  1. steps to make custom action that will run .bat files? or other may to run .bat file.
  2. how to make this custom action with the installation process(for example: just after license agreement)?

*note: my service that I am installing is Delphi service. Regards.

Answer

Jag picture Jag · Dec 15, 2012

Ideally, you should look into creating a component that installs the service using MSI standard action InstallService.

Otherwise, you can use the following steps to execute the batch file during installation.

  1. Create a deferred type 50 custom action (EXE file having a path specified by a property value).
  2. Set it's source to [SystemFolder]\cmd.exe.
  3. Set it's target to "/c path-to-batch-file-on-target-system"
  4. Schedule it action near InstallService.

Also, don't forget to add a rollback custom action that reverts whatever modifications the batch file is doing and schedule it right before this custom action.

[Edited Step 3]