It sounds like an odd request, but the way to do this is to write the script / batch file to the GAC file. Try it yourself without MSI. After working, include the script in MSI, and then execute the script as a custom action to execute during installation. You will also want to remove it from the GAC when uninstalling.
If you are using a Visual Studio installation project, right-click on the project and choose View> Custom Actions. From there, it will allow you to add actions for the relevant events (install, uninstall, etc.).