That’s right. You can wrap a .bat file instead of an executable installer.
Let’s say that you simply want to create a MSI package from a batch file and some other files belonging to that script. You can do that using the MSI Wrapper.
Here is an example of how to do that. The following code is a sample batch file, which will copy a test.txt file to the program files folder under the sub directory MSI Test.
REM -- Get the directory where this script running from SET SCRIPTDIR=%~dp0 REM -- Copy file to program files SET DESTDIR=%ProgramFiles%\MSI Test IF NOT EXIST "%DESTDIR%" MD "%DESTDIR%" COPY "%SCRIPTDIR%\test.txt" "%DESTDIR%\test.txt" REM -- Return exit code 0 EXIT /B 0
Before you wrap this batch file, you place it in an folder together with the test.txt file. Then you specify it as the executable file in the MSI Wrapper.
Other script languages
The exit codes will translate to error states in the MSI. An exit code of 0 (zero) from the batch file will signal success to the Windows installer. Everything else will translate to error 1603 and the installation is a failure. Keep in mind that there is no roll back of what your batch file has changed.
If you want to handle more exit codes in a custom way, you can still use the mapping of exit codes.