5

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.

jacoz
  • 3,508
  • 5
  • 26
  • 42
user1906043
  • 51
  • 1
  • 1
  • 2

1 Answers1

4

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]

Jag
  • 141
  • 2
  • dear,How can i schedule it near InstallService? in InstallExecute Sequence, there is no "Install Service" – user1906043 Dec 16 '12 at 06:44
  • Sorry. I was talking about [InstallServices](http://msdn.microsoft.com/en-us/library/aa369540(v=vs.85).aspx) – Jag Dec 18 '12 at 13:39