I have a scheduled task running at 00:00
that opens a .bat
file containing a robocopy
command, with the task set to stop after 4 minutes, and to force stop if not ending when requested.
It seems the Task Scheduler stop command is ignored until the robocopy
command finishes, which seems to me to defeat the point - is there a way around this?
- The message I would expect is in the history at
00:04
, however the output file ofrobocopy
continues running for a further 4 minutes, only stopping at00:08
:Task Scheduler terminated
{uuid}
instance of theTaskname
task due to exceeding the time allocated for execution, as configured in the task definition.
User Action: Increase the configured task timeout or investigate external reasons for the delay. - There are other commands in the
.bat
file, but therobocopy
step is the one running at the time the scheduler tried to stop the task, with the command after it not running:MkDir "C:\Destination\Folder" RoboCopy "C:\Source\Folder" "C:\Destination\Folder" /MOV /IS /S /R:0 /LOG:"C:\output.txt" RmDir "C:\Destination\Folder" /s /q
RoboCopy
script in Task Scheduler). Microsoft Docs for Task Scheduler would need to be referenced (IIRC, the task itself garnishes script completion or errors from an event within Event Viewer, although I could be misremembering)