xcopy has so many wonderful options but I rarely use it in .bat files because I couldn't get it to copy and rename a file at the same time. e.g., xcopy mike.old mike.new results in a prompt asking me if mike.new is a file or directory!
The /I switch doesn't help since it only applies if more than 1 file is specified as the source.
Found a way around this:
echo f | xcopy src.file dest.renamed.file
The prompt still appears but f is echoed to standard in and the copy proceeds. I mainly use this in visual studio post-build events because the /f option makes it easier to track down build issues (e.g., a file is being copied to the wrong location).
No comments:
Post a Comment