How to overwrite existing files in batch?

后端 未结 10 1313
猫巷女王i
猫巷女王i 2021-01-30 15:17

The following command copies and moves a file but I also need it to overwrite the file it\'s replacing.

xcopy /s c:\\mmyinbox\\test.doc C:\\myoutbox
相关标签:
10条回答
  • 2021-01-30 16:09

    For copying one file to another directory overwriting without any prompt i ended up using the simply COPY command:

    copy /Y ".\mySourceFile.txt" "..\target\myDestinationFile.txt"
    
    0 讨论(0)
  • 2021-01-30 16:11

    If the copy command is run from within a batch job you do not need to use the /Y switch: it will overwrite existing files.

    0 讨论(0)
  • 2021-01-30 16:14

    You can use :

    copy /b/v/y
    

    See SS64 on COPY.

    0 讨论(0)
  • 2021-01-30 16:14

    You can refer Windows command prompt help using following command : xcopy /?

    0 讨论(0)
提交回复
热议问题