XCOPY: Overwrite all without prompt in BATCH
209,571
The solution is the /Y
switch:
xcopy "C:\Users\ADMIN\Desktop\*.*" "D:\Backup\" /K /D /H /Y
Comments
-
FZs over 2 years
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?
-
ttfreeman about 4 yearsthe /Y option only overwrites the pre-existing files: lifewire.com/xcopy-command-2618103
-
ttfreeman about 4 yearsIn my case, I am looking to overwrite EVERYTHING. the contents of one folder to replace another folder's content
-
ttfreeman about 4 yearsI know, stupid windows. each one of them has a different problem. rmdir says folder is in use by another applicaion, Poweshell Remove-Item says dies not have permission and so on.