Batch File Copy and Move Without Overwriting in Windows

batchwindows

I'm trying to create a batch file (to run in the background) that will copy a single file without overwriting any file in the destination with the same name, and then move the file, again not overwriting if there is a file in the destination with the same name?

I'm using this at the moment, but it is overwriting.

copy %1 dest
move %1 dest

Best Answer

Please try this. It works for a single file.

echo N | copy /-Y file1 file2

echo N | move /-Y file1 file2

Interestingly, it seems to work with wildcards as well. I tested that on x64 Windows 7.