Wait for BAT command to run to continue

Asked

Viewed 6,493 times

1

I need to run a bat file with the following content:

ECHO "Mensagem 1"
copy xxx yyy
ECHO "Mensagem 2"
outro.bat param1
ECHO "Mensagem 3"
copy zzz ooo

However when it runs the other.bat my script does not wait for it to finish to run message 3 and the copy command.

2 answers

3


To perform synchronous execution in a bat file I used the CALL resource

Ex:

ECHO "Mensagem 1"
copy xxx yyy
ECHO "Mensagem 2"
call outro.bat param1 > log
ECHO "Mensagem 3"
copy zzz ooo 

0

Try using a wait time (pause on execution) to proceed with the script.

timeout /t 60

In the above case, you will have a 60-second count to proceed with the execution.

  • But I don’t know how long it will take to run the other.bat varies from 30 seconds to 15 minutes.

  • Doesn’t putting the team on a maximum of 15 minutes help you? timeout /t 900

  • Not a good option because it will spend unnecessary time

Browser other questions tagged

You are not signed in. Login or sign up in order to post.