If I understand, you are looking for a way to cancel the job, if got a error after start copying the files.
If you are looking a way manual, just press Ctrl C to abort the script.
If you are looking a way to inclued on your script, you can include a action on script like taskkill
taskkill /im robocopy.exe /f
something like that>
@echo off
setlocal
set source_dir=C:\source
set dest_dir=D:\destination
set retry_count=3
set retry_delay=3
echo Starting Robocopy...
robocopy "%source_dir%" "%dest_dir%" /R:%retry_count% /W:%retry_delay%
if %errorlevel% neq 0 (
echo File copy failed after %retry_count% retries.
echo Waiting %retry_delay% seconds before aborting...
ping -n %retry_delay% 127.0.0.1 > nul
echo Stoping operation...
taskkill /im robocopy.exe /f
)
echo Robocopy complete.
I hope this is work for you.
Regards