This example can show you on how to call another batch script if you are running the main script. You can simply call another set of task to complete the main task. This is a good application if you are working in a server environment if you want to automate your task.
@echo off
:: This is the main batch script
:: Call the other batch script
call other_script.bat
:: The main script can continue executing after the other script is finished
echo This is the main script
echo It has finished running
pause
The above script will call the other batch script (named “other_script.bat”) and then continue executing after the other script is finished. Here’s an example of the other script that could be called by the main script:
@echo off
:: This is the other batch script
echo This is the other script
echo It has finished running
:: The other script can return control to the main script
:: by using the "exit" command
exit
When the other script is finished, it will return control to the main script using the “exit” command.