I need to copy some large sets of files from one server to another (DICOM imagesets). I've written a batch file to automate the process. The batch file reads a text file with a list of cases to copy and then runs a command to copy each one. This basically works.
The /WAIT option is supposed to make START wait until an application completes before proceeding. I'm using START /WAIT to run the program which copies the files. But, START /WAIT only seems to actually wait a maximum of 5 minutes.
In my scenario, this works okay for smaller cases, for which the next one will begin copying immediately after the previous one finishes. But, for larger cases, 5 minutes is not enough time to finish, and so multiple cases wind up copying at the same time. This causes problems, in particular cases not getting copied completely.
I've tried using the /B option with START. This fails in a different way. Specifically, a program running longer than 5 minutes terminates instead of being allowed to run concurrently.
For the record, I'm trying to run this on Windows 10, but I've had the same problem with Windows 7.
The following is the code I'm using:
@echo off
REM Usage - copylist filename.txt > copylog.txt
if exist %1 (
echo File %1 found.
for /f "tokens=*" %%i in (%1) do (
echo "Copying %%i"
START "%%i" /WAIT "c:\conquest\dgate.exe" --movepatient:X-server,Y-server,%%i
)
) else (
echo File was not found.
)