The following command copies and moves the file, but I also need to overwrite the replaced file.
xcopy /sc:\mmyinbox\test.doc C:\myoutbox
Add / Y to the command line
You can use:
copy /b/v/y
Watch SS64 on COPY .
Add /y to the xcopy command line:
/y
xcopy
Example:
xcopy /yc:\mmyinbox\test.doc C:\myoutbox
If the copy command is launched from a batch job, you do not need to use the / Y switch: it will overwrite existing files.
you just need to add / y
xcopy /sc:\mmyinbox\test.doc C:\myoutbox /Y
and if you use a path with spaces try this
xcopy /s "c:\mmyinbox\test.doc" "C:\myoutbox" /Y
You can access the Windows command prompt by using the following command: xcopy /?
xcopy /?
The team that will copy anyway
xcopy "path \ source" "path \ destination" / s / h / e / k / f / c / y
If the destination file is read-only, use /y/r
/y/r
xcopy /y/r source.txt dest.txt