rwoolsey
Posts: 2
Joined: Wed Aug 29, 2018 9:04 pm

Batch file fails to execute with LaunchFile custom action

Hi,

I'm attempting to run a batch file that copies legacy installation files to a new location. I have tried adding said file as a temporary file, adding it as an installed file, and running it in various installation stages. Every configuration I have tried so far has shown similar output to the following lines in the run log:

MSI (s) (58:D4) [13:29:06:922]: Doing action: LaunchFile
Action 13:29:06: LaunchFile.
Action start 13:29:06: LaunchFile.
CustomAction LaunchFile returned actual error code 1 but will be translated to success due to continue marking
Action ended 13:29:08: LaunchFile. Return value 1.

Due to my adding pause commands to the batch file in an attempt to debug the issue I am led to believe that the file is not being executed at all. When run manually from a terminal it performs exactly as I would expect. Any help would be greatly appreciated!

Thanks
Screen Shot 2018-08-29 at 1.50.21 PM.png
Screen Shot 2018-08-29 at 1.50.21 PM.png (103.25 KiB) Viewed 1925 times
Screen Shot 2018-08-29 at 1.58.43 PM.png
Screen Shot 2018-08-29 at 1.58.43 PM.png (106.45 KiB) Viewed 1925 times
Screen Shot 2018-08-29 at 1.50.04 PM.png
Screen Shot 2018-08-29 at 1.50.04 PM.png (63.9 KiB) Viewed 1925 times
Catalin
Posts: 6598
Joined: Wed Jun 13, 2018 7:49 am

Re: Batch file fails to execute with LaunchFile custom action

Hello and welcome to our forums,

From what I can see in your sent screenshot, you have placed the custom action before the "Search" action group and added your .BAT file as a temporary file. Please keep in mind that temporary files are copied on the target machine at the beginning of the installation and are removed at the end of it, ensuring you have access to them throughout the entire install process. They are copied during the CostFinalize standard action and removed during the InstallFinalize standard action.

In order for your custom action to be executed, you have to place it after the CostFinalize standard action. To do this, you can go to "Custom Actions" page, under "Install Execution Stage" right click on any action group --> "Show standard action" --> "Path Resolution" --> click on CostFinalize action. Now, just drag and drop your custom action after the CostFinalize standard action.

Let me know if this helps!

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”