2

what does it mean when I call batch script from batch script without CALL or START?

example. I have two scripts a.bat and b.bat

a.bat:

echo I am A >> log
b.bat
echo end of A >> log

b.bat:

echo I am B >> log
sleep 1
echo end of B >> log

after execution of a.bat i see in the log:

I am A 
I am B 
end of B 

Where is message "end of A" ?

erik80
  • 23
  • 3
  • http://stackoverflow.com/questions/1103994/how-to-run-multiple-bat-files-within-a-bat-file – 001 Jan 29 '13 at 15:22

1 Answers1

3

The end of message a.bat is never reached because when you call another batch file without start or call it transfers control over to that batch, and never returns.

If you wanted it to return to the calling batch, you would use call, or you could use start but that would start another instance of cmd (unless you use the /b switch).

Bali C
  • 30,582
  • 35
  • 123
  • 152
  • Actually even `start /B` starts a new `cmd` instance (check in Windows Task Manager), but no new window is created... – aschipfl May 09 '19 at 10:58