被调用的批处理脚本不返回到调用的批处理脚本 [英] The called batch script not returning to the calling batch script

查看:112
本文介绍了被调用的批处理脚本不返回到调用的批处理脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从另一个批处理脚本(A.bat)中调用一个批处理脚本(例如B.bat).但是,一旦B.bat完成执行,执行似乎就不会返回到A.bat,因为此后批处理文件仍处于执行"阶段. 请参见下面的代码:

I am calling a batch script (say B.bat) from within another batch script (A.bat). However, once B.bat finishes execution, the execution doesnt seem to return to A.bat, as the batch file remains in the 'Executing' stage after that. Please see the code below:

代码:

Set Scanners_Folder=%CD%
echo %Scanners_Folder%
cd "D:\XYZ\bin"
B.bat && echo B.bat succeeded!!
echo DEF

输出:

<Current_directory>
<logs from B.bat>
startup.bat succeeded!!

此后,似乎没有转到A.bat中代码的下一行,在本例中为"echo DEF". 有人可以帮我解决这个问题吗?

After this it does not seem go to the next line of the code in A.bat, which in this case is "echo DEF". Could anyone help me out with this issue?

推荐答案

使用调用:

Set Scanners_Folder=%CD%
echo %Scanners_Folder%
cd "D:\XYZ\bin"
( call B.bat ) && echo B.bat succeeded!!
echo DEF

这篇关于被调用的批处理脚本不返回到调用的批处理脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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