XCOPY: Overwrite all without prompt in BATCH

FZs picture FZs · Oct 31, 2017 · Viewed 162.9k times · Source

I create a batch program, which is copying all files newer than the destination from "C:\Users\ADMIN\Desktop" to "D:\Backup". This code is good:

xcopy "C:\Users\ADMIN\Desktop\*.*" "D:\Backup\" /K /D /H

But it asks every existing destination files: Overwrite file [Yes / No / All]?

I want to OVERWRITE all existing destination files WITHOUT user intervention.

How can I solve this?

Thanks for your answers!

Answer

FZs picture FZs · Aug 21, 2018

The solution is the /Y switch:

xcopy "C:\Users\ADMIN\Desktop\*.*" "D:\Backup\" /K /D /H /Y