How to overwrite existing files in batch mode?

The following command copies and moves the file, but I also need to overwrite the replaced file.

xcopy /sc:\mmyinbox\test.doc C:\myoutbox 
+63
overwrite batch-file
Oct 29 '10 at 11:20
source share
8 answers

Add / Y to the command line

+79
Oct. 29 '10 at 11:23
source share
— -

You can use:

 copy /b/v/y 

Watch SS64 on COPY .

+28
Oct 29 '10 at 11:23
source share

Add /y to the xcopy command line:

Example:

 xcopy /yc:\mmyinbox\test.doc C:\myoutbox 
+18
Aug 20 '13 at 19:30
source share

If the copy command is launched from a batch job, you do not need to use the / Y switch: it will overwrite existing files.

+6
May 28 '15 at 7:37
source share

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 
+6
May 12 '17 at 6:05 a.m.
source share

You can access the Windows command prompt by using the following command: xcopy /?

+2
Feb 08 '16 at 7:35
source share

The team that will copy anyway

xcopy "path \ source" "path \ destination" / s / h / e / k / f / c / y

+1
Oct 06 '17 at 7:15
source share

If the destination file is read-only, use /y/r

 xcopy /y/r source.txt dest.txt 
0
Mar 29 '17 at 9:47 on
source share



All Articles