I'm trying to use RoboCopy in my TFS Build Template to copy some files, but for some reason it inserts "C:\Windows\system32" in front of my Source and Destination paths, even though I am passing in absolute paths. I know that the robocopy.exe is stored in "C:\Windows\system32", but how can I make it use my absolute file paths?

Here is the output from my TFS Build Log. This is the command that gets executed:

RoboCopy 'C:\Builds\27\RQ4TeamProject\BuildProcessTests\Binaries' '\\iq-tfsbuild1\buildDrops\BuildProcessTests\' /E /XD 'RQ4'

And here is the error reported by robocopy:

ROBOCOPY :: Robust File Copy for Windows
Started : Thu Jan 24 17:08:47 2013
Source : C:\Windows\system32\'C:\Builds\27\RQ4TeamProject\BuildProcessTests\Binaries'\
Dest : C:\Windows\system32\'\iq-tfsbuild1\buildDrops\BuildProcessTests\'\
Files : *.*
Exc Dirs : 'RQ4'
Options : *.* /S /E /COPY:DAT /R:1000000 /W:30
2013/01/24 17:08:47 ERROR 123 (0x0000007B) Accessing Source Directory C:\Windows\system32\'C:\Builds\27\RQ4TeamProject\BuildProcessTests\Binaries'\
The filename, directory name, or volume label syntax is incorrect.

Any ideas what is wrong and how I can get it to use JUST the absolute paths I provide? Any suggestions are appreciated. Thanks

  • I know this may sound silly but have you tried double quotes (") instead of single quotes (') ? – BinaryMisfit Jan 25 '13 at 16:38
  • Yup, changing to use double quotes fixed my problem. Strange thing is that I tested it using single quotes from the cmd.exe and from powershell and it worked fine. Oh well, it's working now :) – deadlydog Jan 25 '13 at 20:00
  • I'd like to know how you added the RoboCopy step to your build template....see my frustration here: stackoverflow.com/questions/22180408/… – ganders Mar 5 '14 at 21:02
  • Hi @ganders I've submitted an answer on your post. – deadlydog Mar 6 '14 at 0:26

Use double quotes around the paths if necessary, not single quotes.

  • Yeah, changing the command to the following fixed the problem. Thanks! RoboCopy "C:\Builds\27\RQ4TeamProject\BuildProcessTests\Binaries" "\\iq-tfsbuild1\buildDrops\BuildProcessTests\" /E /XD "RQ4" – deadlydog Jan 25 '13 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.