运行批处理文件顺序 [英] Run batch files sequentially

查看:142
本文介绍了运行批处理文件顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问问大家如何在Windows中运行顺序批处理文件。
我曾尝试:

I want to ask you all how to run batch files sequentially in Windows. I have tried :

start /w batchfile_1.bat 
start /w batchfile_2.bat
..
start /w batchfile_n.bat

但我必须(例如点击)继续进入下一个程序之前手动关闭previous .bat文件的过程。
有没有什么解决办法做到这一点没有自动每次我做手动关闭previous蝙蝠计划?

but I have to close the previous .bat file process manually (e.g. by clicking) before continuing into the next one. Is there any solution to do this automatically without me doing the manual closing previous .bat program every time?

非常感谢。

推荐答案

我会检查的解决这个问题:<一href=\"http://stackoverflow.com/questions/2071408/how-to-run-multiple-batch-files-in-serial-in-windows-command-line-environment\">Run多个批处理文件

I would check the solutions to this question: Run Multiple batch files


  • 从链接中的答案服用。

使用呼叫:

call bat1.cmd
call bat2.cmd

在默认情况下,当你只是运行另外一个控制一个批处理文件将不回传给了调用之一。这就是为什么你需要使用电话。

By default, when you just run a batch file from another one control will not pass back to the calling one. That's why you need to use call.

基本上,如果你有一批这样的:

Basically, if you have a batch like this:

@echo off
echo Foo
batch2.cmd
echo Bar

那么它只会输出

Foo

如果你写的像

@echo off
echo Foo
call batch2.cmd
echo Bar

然而

,它将输出

Foo
Bar

由于batch2终止后,程序控制传回到你原来的批处理文件。

because after batch2 terminates, program control is passed back to your original batch file.

这篇关于运行批处理文件顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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