Why does calling a nested batch file without prepending "call" to the line exit the parent batch file?

Viewed 24127

I understand how to call nested batch files from within a parent file using the call command, as there are plenty of resources on that:

However, I don't understand why calling another batch file from another terminates the parent.

For a less abstract example, suppose I have a batch file that "links" together separate batch files, and I erroneously didn't prepend call to each line:

foo.bat
bar.bat

This would only execute foo.bat and then exit. To correctly execute both commands, I would have to prepend call before each statement:

call foo.bat
call bar.bat

Why does the first functionality still exist? Why hasn't it been changed? I noticed that call was introduced in MS-DOS 3.3, which was released in the late 1980s, so is this functionality still here for reverse compatibility?

I can't think of any (practical) usages of it, but perhaps I'm too used to "new" programming techniques.

3 Answers
Related