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" ?

1

1 Answer 1

4

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).

Sign up to request clarification or add additional context in comments.

1 Comment

Actually even start /B starts a new cmd instance (check in Windows Task Manager), but no new window is created...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.