无需CALL或START即可调用批处理脚本 [英] call batch script without CALL or START

查看:147
本文介绍了无需CALL或START即可调用批处理脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从没有CALLSTART的批处理脚本调用批处理脚本是什么意思?

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

示例.我有两个脚本a.bat和b.bat

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

执行a.bat后,我会在日志中看到:

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

I am A 
I am B 
end of B 

消息"A的结尾"在哪里?

Where is message "end of A" ?

推荐答案

消息a.bat的结尾永远不会到达,因为当您调用另一个没有startcall的批处理文件时,它将控制权转移到该批处理中,永远不会回来.

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.

如果希望它返回到调用批处理,则可以使用call,或者可以使用start,但这将启动cmd的另一个实例(除非使用/b开关).

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

这篇关于无需CALL或START即可调用批处理脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆