中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-10 23:57
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » How can I make command A finish first and then execute command B?
Printable Version  877 / 3
Floor1 nayezi Posted 2008-12-12 23:02
初级用户 Posts 20 Credits 48
I need to implement a batch function similar to using HASH to verify the files in a certain directory, so that the files in directory C and directory D can be kept in sync. The file synchronization is executed through A; after A finishes, then execute B.

How can I make command A finish first and then execute command B? Several ideas don't work:
1. && executes B after A succeeds, but it can't wait for A to finish before executing B, because the execution time is uncertain;
2. Delay: using a delay to control when command B executes still can't solve the timing problem;
3. In the batch file I want to write, A is a Windows application, and the exact parameters are unknown, so its execution time can't be controlled;
4. There is one reliable idea: use a loop to monitor the current process list to see whether process A exists; if process A no longer exists, then execute B. But this approach seems to consume system resources.
5. The effect I want to achieve itself has uncertain timing.

Thanks everyone, I'm asking for advice here.

[ Last edited by nayezi on 2008-12-12 at 23:13 ]
Floor2 HAT Posted 2008-12-12 23:16
版主 Posts 5,017 Credits 9,023
Give the real program names. Nobody knows what programs ABCD are.
Floor3 feiyuguochen Posted 2008-12-14 11:18
初级用户 Posts 36 Credits 34
Try this line of thinking and see whether it works. That is, use the errorlevel from executing A; for example, after it executes successfully, then call / call B
Floor4 exzzz Posted 2008-12-15 17:04
初级用户 Posts 167 Credits 194
The OP should change the C command mentioned in the subject description. It should be changed to program C.

I guess this is for synchronization in an Internet cafe: wait for synchronization to complete, then execute the follow-up patch. Current synchronization software all has this kind of function, that is, what command to execute after synchronization is complete. For example, lanupdate can do it
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023