vikram.fartyal
vikram.fartyal

Reputation: 148

how to stop calling another batch script from main batch script if first calling batch script gives any error..?

I have one windows batch script where I am calling two other batch script. What I want - if my first batch gives any error it should not call second batch; rather it should immediately exit the main batch script. Here is my main batch file(main.bat) code:

echo.[INFO] Calling Joomla setup batch file
call joomla_setup.bat
echo.[INFO] Finished Joomla setup batch file execution
echo.[INFO] Calling Build and deploy setup batch file
call build_deploy.bat
echo.[INFO] Finished Build and deploy setup batch file execution
ECHO.&ECHO.Press any key to exit COSOMO installer.&PAUSE>NUL&GOTO:EOF

In this code, if joomla_setup.bat gives any error in execution I want main.bat not to call build_deploy.bat and exit immediately. Any quick and useful response would be appreciable.

Upvotes: 0

Views: 494

Answers (1)

Joey
Joey

Reputation: 354516

call joomla_setup.bat || exit /b 255

Of course, that relies on joomla_setup.bat using exit codes to signal failure. If that's not the case it would be helpful to know how you would determine failure in your example.

Upvotes: 2

Related Questions