Link to home
Start Free TrialLog in
Avatar of Gina Bautista
Gina BautistaFlag for United States of America

asked on

How To Create Master Batch File To Call Other Batch Files On Success Only

I stop server services prior to the server backups.  Then the backup runs.  Then the server services are restarted.  This is all done through three separate batch files scheduled in Task Scheduler.
I need help in creating a master batch file that calls one batch file, then on success call another batch file that restarts server services.  If the first batch file fails to complete, I need some sort of alert of failure.  Is there way to set it so that second batch starts regardless?  Since these are server services I need them up and running for the business day.
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gina Bautista

ASKER

Do I use the errorlevel within the first batch file or in this example file above?  
Sorry, I should have explained that, but thought it is obvious.
   A && B || C
executes A, and if it returns 0 (no error), B. If the errorlevel is different from zero, C runs instead of B.
So your batch file A should just return a zero if ok, and something else otherwise.
I will give this a try and see what happens.  Thank you very much.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
The solution has been partially tested and seems like it will help when fully deployed,.