Windows copy command return codes?

前端 未结 5 518
[愿得一人]
[愿得一人] 2020-12-15 16:43

I would like to test for the success/failure of a copy in a batch file, but I can\'t find any documentation on what if any errorlevel codes are returned. For example

<
5条回答
  •  心在旅途
    2020-12-15 17:14

    I believe Copy only returns 0 for success or 1 for failure.

    XCopy has documented return codes:

    0 = Files were copied without error.
    1 = No files were found to copy.
    2 = The user pressed CTRL+C to terminate xcopy.
    4 = Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
    5 = Disk write error occurred.

提交回复
热议问题