简体   繁体   English

从另一个批处理文件调用,然后在批处理文件2存在后继续批处理文件1

[英]Call one batch file from another and then continue batch file 1 after batch file 2 exists

I am calling batch file (say file2.bat) from another batch file (say batch file 1). 我从另一个批处理文件(比如批处理文件1)调用批处理文件(比如file2.bat)。

file1.bat: file1.bat:

echo off
@call file2.bat
@echo abc
@echo xyz
exit

I am using command exit /b to exit from file2.bat .. 我使用命令exit /b退出file2.bat ..

For some reason, the control is not coming back to file1.bat after file2.bat exits.. 出于某种原因,在file2.bat退出后,控件不会返回到file1.bat。

What needs to be done in order to return the control back to file1.bat so that the remaining commands @echo abc @echo xyz should execute? 为了将控制权返回给file1.bat需要做什么,以便剩余的命令@echo abc @echo xyz应该执行?

Thanks 谢谢

使用cmd /c file2.bat或使用goto :EOF (其中EOF表示文件结尾 ), goto :eof应该适用于你的情况

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM