How do I write a batch script that copies one directory to another, replaces old files?

前端 未结 5 522
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-01 09:59

I\'d like a batch script in Windows with which I can copy one directory to another. If this directory already exists, and then for each file that already exists in both with the

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 10:26

    Try this:

    xcopy %1 %2 /y /e

    The %1 and %2 are the source and destination arguments you pass to the batch file. i.e. C:\MyBatchFile.bat C:\CopyMe D:\ToHere

提交回复
热议问题