The following command copies and moves a file but I also need it to overwrite the file it's replacing.
xcopy /s c:\mmyinbox\test.doc C:\myoutbox Add /Y to the command line
"'s. If you have a " inside an argument which is enclosed (which is never the case for filenames) double it.dir /X in folder above to get the directory name with a ~ in it instead. The you don't need the quotes if you use that abridged variant. Source: superuser.com/questions/179449/…Add /y to the command line of xcopy:
Example:
xcopy /y c:\mmyinbox\test.doc C:\myoutbox you need to simply add /Y
xcopy /s c:\mmyinbox\test.doc C:\myoutbox /Y and if you're using path with spaces, try this
xcopy /s "c:\mmyinbox\test.doc" "C:\myoutbox" /Y
xcopyhas been deprecated. Although it's still ships -robocopyis the successor.