0

I have a couple of batch files. One is the parent and others are children that are called by the parent.

Let's say I have Deploy.bat that calls ExtractParameters.bat.

In ExtractParameters.bat I want to be able to stop the entire process.

If I use exit /b the rest of the Deploy.bat would be executed.

If I use exit then the Deploy.bat is also stopped, but my command line window is also closed.

What I want is to keep my command line window open, but stop the parent script from child script.

What can I do?

2
  • Not sure this is possible. I probably would launch the parent batchfile in a new window, so it doesn't matter if its killed or not. (start batchfile.bat)
    – LPChip
    Commented Apr 29, 2022 at 8:17
  • 1
    One possible workaround is having the child batch file change a variable when it's done, that the parent batch reads in a loop (for example every minute).
    – MiG
    Commented Apr 29, 2022 at 8:19

1 Answer 1

1

Commonly, the exit code of a child script is examined in the parent, and, if the error level shows a fault, the parent can interrupt processing, or go to fault-handling code (not what I'd term true exception handling, but likely good enough, from your description).

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .