XCOPY is an old team returning to the days of DOS. It appears that the / EXCLUDE option has never been updated to support long file names. Ugh: - (
If you remove quotation marks, the text after the space is interpreted as an additional parameter, and you get the error "Invalid number of parameters." If you save quotes, then it treats quotes as part of the path and reports that it cannot find the file.
I believe that you have three possible solutions:
1) Use 8.3 short folder names in your path.
Of course, this will not work if your volume has short names.
2) Use the SUBST command to create a drive alias for your hard way.
subst Q: "Y:\path with spaces" xcopy X:\ "Y:\...\bin\9876543210\" /c /g /d /i /e /r /h /y /exclude:Q:exclude.txt subst Q: /d
This can be a problem if you do not know the free drive letter.
3) (my favorite) Just PUSHD follow the unpleasant path and execute the command from there :-)
pushd "Y:\path with spaces" xcopy X:\ "Y:\...\bin\9876543210\" /c /g /d /i /e /r /h /y /exclude:exclude.txt popd
For more details see https://sevenx7x.wordpress.com/2009/01/02/xcopy-with-exclude-option-shows-cant-read-file/ and http://forums.majorgeeks.com/showthread.php? t = 54300 .
source share