aswinsrinivasan02
Posts: 11
Joined: Fri Mar 04, 2022 10:47 am

Running batch files having sub-batch files

Hi Team,
First of all, thank you for all the responses you have been giving to my posts before in such quick pace! Have never seen such support elsewhere! Special thanks to Catalin!

Now coming to my problem, I have a Honeywell USB Driver that is provided only as a batch file and not as msi installer. This batch file when running separately via cmd prompt, opens up another cmd promt after few seconds and then runs some more batch files on the new window.
1. I have added that folder in my Temporary Folder (as it is not required post installation).
2. I have added a Launch File custom Action with the following settings
FileToLaunch: [#setup.bat]
Command Line: /silent /install /machine
Run As Administrator - Checked

Execution Time:
When the system is being modified (deferred)

Under Execution Options:
Wait For custom action to finish before proceeding - UNCHECKED
Wait For return code at the end of the sequence - CHECKED

This setup.bat uses multiple other bat files to perform its installations.

But the problem is when the batch file is started, immediately the installer goes to the FINISH page (thereby removing the temporary file) and I can see that the files don't exists error comes up on the cmd screen opened by the initial setup.bat file.

Can someone help me out on this?

Regards
Aswin Srinivasan
Liviu
Posts: 1325
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Running batch files having sub-batch files

Hello Aswin,

That may happen because of the temporary file. Unlike Advanced Installer's regular files or resources, "Temporary Files" are copied on the target machine at the beginning of the installation and are deleted at the end of it, ensuring you have access to them throughout the entire install process.

Temporary Files are copied during the CostFinalize standard action, at the beginning of the setup and removed during the InstallFinalize standard action.

Since your setup does not wait for your custom action to finish, then it goes in the last step and the file is not accesible anymore.

Can you please check the "Wait For custom action to finish before proceeding" option and let me know if that helped?

Also, temporary files are called using the "&" sign, instead of "#":

Code: Select all


[&setup.bat]
For more information, please refer to the below link:

Launch file custom action

Hope that helps! If you have any other questions, please don’t hesitate to contact us.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: Running batch files having sub-batch files

Hello Aswin,

First of all, thank you for your kind words.

In addition to what my colleague Liviu said, please note that, if you have added your files as "Temporary Files", you can select to not remove them when the installation ends.

To do so, please go to "Files and Folders" page --> double click on your temporary file --> check the "Do not remove when installation ends" option.

I will attach below a screenshot for your reference:
TempFile.png
TempFile.png (68.28 KiB) Viewed 1956 times

As you can see in my screenshot, Temporary Files have a special icon (unlike regular files).

Hope this helps!

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

Return to “Common Problems”