
Re: How do you Exit from all child and parent batch processe
The only way I know to exit all child and parent batch processes without closing the CMD shell is to intentionally introduce a fatal syntax error. (jeb introduced this technique to me)
Code:
call :kill 2>nul
:kill - Kills all batch processing with a fatal syntax error
()
If you want to kill the current batch file but not any parent batch file, then you can use a variation of what Fawers was suggesting.
Your batch file can re-execute itself via CMD and use EXIT to kill it.
Code:
@echo off
if "%~1" neq "_GO_" (
cmd /c "%~f0" _GO_ %*
exit /b
)
REM Your normal code goes here
exit
Dave Benham