outter.bat
echo "start to call inner bat here"inner.bat
inner.bat //第2行
echo "Back to outter bat" //注意这一行,它并未运行
echo "inner bat has been called."如果像上面的在outter.bat调用inner.bat。我们发现outter.bat的第3行未执行。即inner完成后并不会把控制权交回outter。
正确的方法应该是:在所调用的批处理文件名前加上call,把文件的第2行变为call inner.bat即可,如下:
outter.bat
echo "start to call inner bat here"inner.bat
call inner.bat //第2行
echo "Back to outter bat" //注意这一行,它并未运行
echo "inner bat has been called."