windows 如何让批处理文件等待另一个批处理文件完成执行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2572176/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I make the batch file wait until another batch file completes execution?
提问by Arunachalam
How can I make a batch file wait until another batch file has finished?
如何让批处理文件等待另一个批处理文件完成?
For example, I have:
例如,我有:
echo hi >r.txt
echo some piece of code >>r.txt
start ar.bat
echo some piece of code >>ar.txt
I want the code after start ar.bat
to execute only after ar.bat
finishes executing. I tried without start
and it works, but I want to run ar.bat
in a separate window.
我希望之后的代码start ar.bat
仅在ar.bat
执行完成后才执行。我试过没有start
,它可以工作,但我想ar.bat
在单独的窗口中运行。
Is there any method to check whether ar.bat
has finished?
有没有什么方法可以检查是否ar.bat
已经完成?
回答by Anders Abel
Use call ar.bat
to do it completely with batch file commands.
用于call ar.bat
完全使用批处理文件命令来完成。
Use start /wait ar.bat
to get another window and wait for it to complete.
使用start /wait ar.bat
得到另一个窗口,等待它完成。