Reputation: 18619
I'm writing a batch program for copying all files newer than the destination from "C:\Users\ADMIN\Desktop" to "D:\Backup".
This code is works:
xcopy "C:\Users\ADMIN\Desktop\*.*" "D:\Backup\" /K /D /H
However, it asks for each existing destination file: Overwrite file [Yes / No / All]?
I want to overwrite all existing destination files without user intervention.
How can I solve this?
Upvotes: 125
Views: 340330
Reputation: 59
I wanted to copy some backups from a share location (or server) to a local one by replace option, so I use this code and it worked well:
Xcopy "\\bi-srv\SQL\Backup" "E:\backup\sql\Backup" /c /i /e /h /y
just save it in a bat format and schedule it by windows task scheduler
Upvotes: 4
Reputation: 18619
The solution is the /Y
switch:
xcopy "C:\Users\ADMIN\Desktop\*.*" "D:\Backup\" /K /D /H /Y
Upvotes: 209