Hi, I have a batch file which runs a robocopy command. I am using Windows task scheduler to run the scrpt nightly. I have schueduled the batch file to run between 8pm and 8am when the users aren't around so that most files robocopy tries to copy are not in use.
The problem I am having is that if task scheduler terminates the batch file at 8am the robocopy process is still left running. Is there a way I can add to the batch file so that when the batch file closes the robocopy process it has spawned is also terminated?
My batch file is below:
set src="U:\source folder"
set dest="V:\destination folder"
robocopy %src% %dest% /TBD /MT:32 /MIR /XJ /XF *.tmp /XD "$RECYCLE.BIN" "System Volume Information" /ZB /R:1 /W:1 /LOG+:%logname%
To make things more complicated I am running other robocopy jobs on the same computer so ideally I want to kill only the process spawned by this particular batch file.