0

I am using robocopy in windows cmd terminal, and the code is

SET source="C:\DevSPInstaller2013\"
SET destination="D:\Backup\SP2013 VM\v2\"      
Robocopy.exe %source% %destination% /e /np /eta /r:1 /w:1 /log:"D:\Logs\sp.txt"

But it just fails with Invalid pramater #3 : "VM\v2"

I have quotes so I am not sure what is wrong...

Does anyone know?

Thanks

omega
  • 40,311
  • 81
  • 251
  • 474
  • Your problem are the ending backslashes. While related to another command, [this answer](http://stackoverflow.com/a/25841519/2861476) to [“invalid path 0 files copied” Error while using xcopy command](http://stackoverflow.com/q/25840861/2861476) could help you resolve the problem. – MC ND Aug 23 '16 at 06:53

1 Answers1

0

WinAPI function GetCommandLine() seems to have problem with quotes removed on expansion of environment variables. You should surround filenames with quotes right on command-line instead of during their assignment with SET. Try this:

SET source=C:\DevSPInstaller2013\
SET destination=D:\Backup\SP2013 VM\v2\
Robocopy.exe "%source%" "%destination%" /e /np /eta /r:1 /w:1 /log:"D:\Logs\sp.txt"
vitsoft
  • 5,515
  • 1
  • 18
  • 31