Dh0rse
Dh0rse

Reputation: 48

How do i combine a bat file with an MSI?

I have an MSI Installer that I created in WIX that i would like to be run from a .bat file, but I need it to be in one MSI file. How would i do that? for example i have a .bat file that does this

MD C:\TEMP\BATS
START /W msiexec /i Installer.msi /l*v C:\TEMP\BATS\INSTALLERLOG.txt
SLEEP 5
DEL C:\TEMP\INSTALLERLOG.txt
RD C:\TEMP

I want to create an .msi or .exe file that contains both the .bat file and the .msi file and will unpackage the two files and run the .bat file. Is this possible? I am doing it just to force Logging that will be displayed to the user through a custom action if the installer fails some how.

Upvotes: 2

Views: 2030

Answers (2)

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32250

It sounds like you are caught by the technical details of the counterparts of your solution. Try to forget what you have for a moment and think of what you actually need.

As far as I can tell from your code snippet, the bat file creates a temporary directory, runs MSI package installation with verbose logging option, and then deletes the generated log file... Sounds a bit of no sense to me...

This is whatI would do in your case:

Get rid of that bat file

Ask yourself what its purpose is. If it is there to modify the target system, then revise this logic and move it to your MSI package following all the best practices you can find. If it has to to some service work, e.g. prepare parameters for the main MSI package, then consider authoring a bootstrapper.

Upvotes: 3

Mike
Mike

Reputation: 19

You can try IExpress to generate a single EXE file. Another solution would be to use a self-extracting EXE archive which can launch a specific file when it finishes extracting.

Upvotes: 0

Related Questions