Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Under some circumstances, xcopy will return the error Invalid number of parameters without giving you a clue as to what’s going on. The usual solution for this is to be sure that your filenames are enclosed in quotes, as this can be an issue with batch files where you have something like xcopy %1 %2 and you really need xcopy "%1" "%2". I recently ran into a problem, however, where the problem wasn't spaces:

C:\Temp\foo>c:/windows/system32/xcopy.exe /f /r /i /d /y * ..\bar\
Invalid number of parameters
share|improve this question

migrated from Feb 27 '10 at 9:44

This question came from our site for professional and enthusiast programmers.

up vote 12 down vote accepted

The solution to this one was tricky: it turns out that xcopy is parsing the forward slashes in the path to its own binary. This works fine:

C:\Temp\foo>c:\windows\system32\xcopy.exe /f /r /i /d /y * ..\bar\
C:\Temp\foo\blah -> C:\Temp\bar\blah
1 File(s) copied

You can also run into this if you have your PATH defined using forward slashes instead of backslashes.

share|improve this answer
Also if you're using this as a Post-build event, you have to make sure that you put quotes around the full path of $(TargetDir), as there might be spaces in the path: xcopy "$(TargetDir)*.dll" ..\..\Project.Web\bin – Highmastdon Jan 8 '15 at 12:17
This can also happen if you have forward slashes in Source or Destination Path. Just replace all forward slashes with backslashes in all the path that you pass to xcopy! – Juraj Petrik Nov 18 '15 at 15:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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