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 ]
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 ]

