How do I STOP a robocopy that is in progress?

Marscaleb 26 Reputation points
2023-03-02T01:50:35.66+00:00

I am using robocopy to copy a large amount of files.

I find that there is an issue of some kind and I need to stop/quit the process.

How do I do this?

I did an internet search and I keep getting the same response about hitting pause, each time reciting the same line verbatim. But I'm not looking to pause the command, I want to outright stop it, cancel it, quit it.
How do I STOP robocopy once it has begun?

Windows for business | Windows Client for IT Pros | User experience | Other
{count} vote

Accepted answer
  1. Fabricio Godoy 2,626 Reputation points
    2023-03-02T05:04:14.7033333+00:00

    @Marscaleb

    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

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.