Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run batch file in Windows Installer Commit

I am having no success in modifying a Windows Installer MSI to run a batch file after the primary output has been installed. I have searched for this and found many suggestions, but nothing that works.

Add a Custom Action
Custom actions can only be executable files. A batch file is not executable.

Create a Windows Scripting Host executable that runs the batch file
Many people have tried to do this, including on SO, and no one has been able to get this to work.

Use WIX or InstallShield
I do not have the time or authority to change company installer technology.

Edit the .msi with Orca and add a custom property, then a custom action, then edit the InstallExecuteSequence, ...
I have been trying this for hours and have only created installers that throw a system error when I run them.
like image 598
Dour High Arch Avatar asked Jun 15 '09 22:06

Dour High Arch


People also ask

How do I run a batch file while installing?

Windows Installer cannot launch batch files directly by using installed or attached custom actions. However, in Advanced Installer you can run a CMD or BAT file through a Launch file predefined custom action. In the case of a 64-bit CMD or BAT file you can just enable the option Use 64-bit Launcher.


1 Answers

What you said above is incorrect:

Custom actions can only be executable files. A batch file is not executable.

Custom Actions (even without tools like InstallShield) can be .EXE, VBScript, JScript, or DLL based. If you write a DLL, you can write whatever code you want to call a batch file or make any changes you want to the system -- there is no limit.

Update: an example that worked for me: (entry in CustomAction table)

Action Test
Type 34
Source SystemFolder
Target cmd.exe /c c:\test.bat
ExtendedType <blank>
like image 156
William Leara Avatar answered Sep 28 '22 08:09

William Leara