If you use a regular batch, and don't implement START or alike to spawn new processes, then it will wait for the previous command to finish before continuing.
Batch won't advance to the next command until it receives an exit code from the previous command. So in the context of a basic file copy, it will wait for the copy command to complete. You can witness this by simply running a Copy command from the command prompt; it won't give you the prompt back until it's done copying.
Now, where you may run into trouble is when you launch a program that spawns new processes that do work that you need to wait for.
For example, the launcher program may exit (returning an exit code to the batch file, causing it to continue on) before the new process it started finishes doing what you need done before continuing the batch.
In those cases you'll need to either pause the batch file for an amount of time (and hope that it finishes within that time), or use a loop in the batch to monitor for the process to finish (ie: with tasklist
) before continuing.
1Well if the file is like 4GB then yes, It cannot open the file if its still transferring. A way is to use
ping 127.0.0.1 -n 6 > nul
Ofcourse 4GB will take longer than 5 seconds. DOS does not wait for 1 command to finish. – Dylan Rz – 2016-10-05T14:16:23.490Ok that is what I was wondering, if it checks whether or not a command is finished before going on to the next – Daniel – 2016-10-05T14:19:58.660
Nope Dos will not wait for 1 command to finish. You probably then have to use If else statements
If xx file exists - go to.
you get the idea. – Dylan Rz – 2016-10-05T14:20:52.607