开发者

how to write a "bat" file to implement two "exe" files by turns multiple times

开发者 https://www.devze.com 2023-01-07 13:17 出处:网络
I have two \"exe\"(A and B) files and a input(C) file. Firstly, The A file will take C as input to execute and then update input(C) file.

I have two "exe"(A and B) files and a input(C) file.

  • Firstly, The A file will take C as input to execute and then update input(C) file.
  • Next, B file will take C as input to execute and then update input(C) file.
  • ...
  • ...
  • ...

These two s开发者_高级运维teps will repeat multiple times.

Which kind of command should I use?


@Echo Off
SETLOCAL EnableDelayedExpansion
SET LIST=cmd cmd

FOR %%G IN (%LIST%) DO (
SET NAME=%%G
START /WAIT CMD /C !NAME!
)


Sounds scary...

You need to keep File Locking in mind so your applications do not step all over each other.

Two processes that modify the same shared resource can lead to all sorts of troubles.

Is this for work/fun or school?


You can use for loops in batch files. It's not completely clear what you are wanting, but the following command will run a.exe and then b.exe 3 times each passing the parameter c.dat to each one:

for /l %l in (1,1,3) do for %a in (a.exe b.exe) do %a c.dat
0

精彩评论

暂无评论...
验证码 换一张
取 消