XCOPY: Overwrite all without prompt in BATCH

WindowsBatch FileCmdXcopy

Windows Problem Overview


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?

Windows Solutions


Solution 1 - Windows

The solution is the /Y switch:

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFZsView Question on Stackoverflow
Solution 1 - WindowsFZsView Answer on Stackoverflow