how to use space within pathname for Window's Robocopy

5,446

Solution 1

In your command ROBOCOPY "C:\Users\doug\Documents\My Scans\" "B:\BACKUP\My Scans\" /e /NFL /NDL the ending slashes are escaping the double quotes symbols. Robocopy then assumes that it's a full argument, which it then can't find. Try one of these instead:

ROBOCOPY "C:/Users/doug/Documents/My Scans/" "B:/BACKUP/My Scans/" /e /NFL /NDL
ROBOCOPY "C:\Users\doug\Documents\My Scans\\" "B:\BACKUP\My Scans\\" /e /NFL /NDL
ROBOCOPY "C:\Users\doug\Documents\My Scans" "B:\BACKUP\My Scans" /e /NFL /NDL

Solution 2

Remove the trailing backslashes on your source and destination.

"C:\Users\doug\Documents\My Scans" "B:\BACKUP\My Scans"

Edit: Somehow Blerg beat me to it. What he said.

Share:
5,446

Related videos on Youtube

Doug Null
Author by

Doug Null

Updated on September 18, 2022

Comments

  • Doug Null
    Doug Null over 1 year

    When my path for robocopy has a space, I surround it with " but get the weird error below...

    My .bat file contains:

    rem Backup scans
    ROBOCOPY "C:\Users\doug\Documents\My Scans\"  "B:\BACKUP\My Scans\"  /e /NFL /NDL
    
    pause
    

    AND I GET THIS ERROR:

    C:\Windows\system32>rem Backup scans
    
    C:\Windows\system32>ROBOCOPY "C:\Users\doug\Documents\My Scans\"  "B:\BACKUP\My
    Scans\"  /e /NFL /NDL
    
    -------------------------------------------------------------------------------
       ROBOCOPY     ::     Robust File Copy for Windows
    
    -------------------------------------------------------------------------------
    
      Started : Thu Jun 23 19:32:29 2016
    
       Source : C:\Users\doug\Documents\My Scans"  B:\BACKUP\My\
         Dest : C:\Windows\system32\Scans"\
    
        Files : *.*
    
      Options : *.* /NDL /NFL /S /E /COPY:DAT /R:1000000 /W:30
    
    ------------------------------------------------------------------------------
    
    2016/06/23 19:32:29 ERROR 123 (0x0000007B) Accessing Source Directory C:\Users\d
    oug\Documents\My Scans"  B:\BACKUP\My\
    The filename, directory name, or volume label syntax is incorrect.
    
    C:\Windows\system32>pause
    Press any key to continue . . .