Thursday, 15 May 2014

windows - exit a batch script that called another batch script -



windows - exit a batch script that called another batch script -

i have batch script calls sequence of batch files.

there error case need exit batch file called, parent batch file. possible accomplish within kid batch file? in advance tips/help.

test.bat

rem test1.bat exit error code. phone call test1.bat rem want script stop if test1.bat errors. phone call test2.bat

test1.bat

rem can test.bat terminate within test1.bat? exit /b 1

you can, using errorlevel. if called batches systematically utilize exit 0 notify keep on , exit 1 inquire caller stop, can modify caller way :

rem test1.bat exit error code. phone call test1.bat rem want script stop if test1.bat errors. if errorlevel 1 goto fatal phone call test2.bat exit 0 :fatal echo fatal error exit 1

windows batch-file cmd call parent

No comments:

Post a Comment