Robocopy – ERROR 123 (0x0000007B) – copy directories with spaces

robocopy meme

the problem

Using a current PowerShell with tab completion (the shell adds all quotes and spaces) you get the command:

Robocopy.exe 'C:\tmp\source with spaces\' 'C:\tmp\target with spaces\' /e

And executing it you get the error message:

robocopy the filename directory name or volume label syntax is incorrect

Note that the source and target are “strangly” interpreted. The \' at the end of the source and target escapes the slash and thus the whole command gets erroneous.

The solution

The solution is super easy, you simply remove the last backslash from source and target.

Robocopy.exe 'C:\tmp\source with spaces' 'C:\tmp\target with spaces' /e

Leave a Reply

Your email address will not be published. Required fields are marked *