无法从在Win7主批处理文件运行多个批处理文件顺序 [英] Can't run multiple batch files sequentially from master batch file in Win7

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

问题描述

我有一大堆的批处理文件,每启动一个可执行一堆的同时运行。每一个批处理文件,启动30可执行文件。当这些30完成后,我希望下一批可执行文件来同时运行,再次30。 .exe文件的使用在批处理文件开始命令调用和他们的工作就好了 - 我可以运行单独的批处理文件为每组30 exe​​和他们同时像他们应该运行

I have a bunch of batch files that each start a bunch of executables to run concurrently. Each batch file starts 30 executables. When those 30 are done, I want the next batch of executables to run, again 30 at a time. The .exe's are called using the "start" command in the batch files and they work just fine - I can run the individual batch files for each group of 30 exe's and they run concurrently like they should.

我已经创建调用每个子批处理文件主的批处理文件,但我无法弄清楚如何得到它的顺序运行子批处理文件,等待一个开始下一个之前完成。

I have created a "master" batch file that calls each sub-batch file but I can't figure out how to get it to run the sub-batch files in sequence, waiting for one to finish before starting the next.

如果主批处理文件是这样的:

If the master batch file is like this:

Batch1.bat
Batch2.bat
Batch3.bat

那么只有第一个批处理文件叫做 - 别人从来不被称为

then only the first batch file is called - the others are never called.

如果主批处理文件是这样的:

If the master batch file is like this:

call Batch1.bat
call Batch2.bat
call Batch3.bat

然后所有的子批处理文件开始在同一时间运行,并且我得到数百可执行文件试图在同一时间启动。

then all of the sub-batch files start running at the same time and I get hundreds of executables trying to start up at the same time.

如何让我的主批处理文件调用第一个批处理文件,等待它完成,然后调用了下,等待它完成,然后调用了下,等?

How do I make the master batch file call the first batch file, wait for it to finish, then call the next, wait for it to finish, then call the next, etc?

由于提前,

rgames

推荐答案

对不起。我认为这里有一个误解。如果你的主批处理文件是这样的:

Excuse me. I think there is a misunderstanding here. If your master Batch file is this:

call Batch1.bat
call Batch2.bat
call Batch3.bat

则Batch2.bat称为Batch1.bat结束后,等等。你可以做一个小测试,以确认这一点。在另一边,可能是每个BatchN.bat程序使用的相同的变量?如果是这样,那么从Batch1.bat剩下最后值可以与Batch2.bat干扰,等等。在这种情况下,你必须在每个批处理文件的开头添加 SETLOCAL 命令。

then the Batch2.bat is called after Batch1.bat ends, and so on. You may do a small test to confirm this. On the other side, is possible that each BatchN.bat program uses the same variables? If so, then the last values left from Batch1.bat may interfere with Batch2.bat, and so on. In this case, you must add a Setlocal command at beginning of each Batch file.

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

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