Windows批处理文件:在语句中的步骤之间等待

时间:2022-03-18 02:22:50

I am trying to use a for statement in a Windows batch file ("File A") to call another program ("File B") for each .pdv (Procoder DV, not part of the problem) file in a particular directory. I want File A to wait until File B has finished running on the first .pdv file before it asks File B to run on the next .pdv file, but instead, all the calls to File B are happening at once. Here's File A:.

我试图在Windows批处理文件(“文件A”)中使用for语句为特定目录中的每个.pdv(Procoder DV,不是问题的一部分)文件调用另一个程序(“文件B”)。我希望文件A等到文件B在第一个.pdv文件上运行完毕,然后它要求文件B在下一个.pdv文件上运行,但是,所有对文件B的调用都会立即发生。这是文件A:。

for %%X in (*.pdv) do (start /wait /b "My title" "File B" %%X)

Is there a way to get the calls to File B to happen sequentially (and if so, what is it)?

有没有办法让文件B的调用顺序发生(如果是这样,它是什么)?

2 个解决方案

#1


You need to call the program that process .pdv files instead of calling start e.g.

您需要调用处理.pdv文件的程序,而不是调用start,例如

for %%X in (*.pdv) do (pdv_processor.exe "%%X")

#2


In addition to this you are able to wait a certain time by calling the ping command. Wait 5 seconds:

除此之外,您还可以通过调用ping命令等待一段时间。等5秒钟:

ping 127.0.0.1 -n 5>nul

#1


You need to call the program that process .pdv files instead of calling start e.g.

您需要调用处理.pdv文件的程序,而不是调用start,例如

for %%X in (*.pdv) do (pdv_processor.exe "%%X")

#2


In addition to this you are able to wait a certain time by calling the ping command. Wait 5 seconds:

除此之外,您还可以通过调用ping命令等待一段时间。等5秒钟:

ping 127.0.0.1 -n 5>nul