我对批处理脚本有点陌生。作为一名新手,我发现这两种方法都很有用,在编写脚本时,x拷贝和机器人拷贝之间的主要区别是什么?
发布于 2014-06-09 13:21:18
在新版本的windows中,Robocopy取代了XCopy。
是的,我同意马克·塞切尔的观点,他们都是垃圾。(微软带给你的)
更新:
XCopy返回代码:
0 - Files were copied without error.
1 - No files were found to copy.
2 - The user pressed CTRL+C to terminate xcopy. enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
5 - Disk write error occurred.机器人返回代码:
0 - No errors occurred, and no copying was done. The source and destination directory trees are completely synchronized.
1 - One or more files were copied successfully (that is, new files have arrived).
2 - Some Extra files or directories were detected. No files were copied Examine the output log for details.
3 - (2+1) Some files were copied. Additional files were present. No failure was encountered.
4 - Some Mismatched files or directories were detected. Examine the output log. Some housekeeping may be needed.
5 - (4+1) Some files were copied. Some files were mismatched. No failure was encountered.
6 - (4+2) Additional files and mismatched files exist. No files were copied and no failures were encountered. This means that the files already exist in the destination directory
7 - (4+1+2) Files were copied, a file mismatch was present, and additional files were present.
8 - Some files or directories could not be copied (copy errors occurred and the retry limit was exceeded). Check these errors further.
16 - Serious error. Robocopy did not copy any files. Either a usage error or an error due to insufficient access privileges on the source or destination directories.这里有更多关于Robocopy返回值的详细信息:http://ss64.com/nt/robocopy-exit.html
发布于 2014-06-10 03:09:13
最重要的区别是,当发生错误时,robocopy (通常)会重试,而xcopy则不会。在大多数情况下,这使得robocopy更适合在脚本中使用。
增编:为了完整起见,机器人复制有一个已知的边缘问题;如果这是一个问题,您可能需要查看第三方工具,或者编写自己的工具。
发布于 2016-08-15 20:16:37
我能看到的不同之处是,Robocopy有更多的选择,但我发现它们中的任何一个都没有特别的帮助,除非我正在做一些特别的事情。
我对几个复制例程做了一些基准测试,发现XCOPY和Robocopy是最快的,但令我惊讶的是,XCOPY始终在ROBOCOPY之外。
具有讽刺意味的是,机器人复制重新尝试了一个失败的副本,但它也在我的基准测试中失败了很多,而xcopy从来没有成功过。
在我的基准测试之后,我对完整文件(逐字节)文件进行了比较。
下面是我在测试中使用的用于机器人复制的开关:
**"/E /R:1 /W:1 /NP /NFL /NDL"**. 如果有人知道一个更快的组合(除了删除/E,我需要),我很想听听。
机器人复制的另一个有趣/令人失望的事情是,如果一个拷贝确实失败了,默认情况下,它会在每次尝试之间延迟30秒重试100万次。如果您正在运行一个长批处理文件,您可能会非常失望,当您回来几个小时后,发现它仍然试图复制一个特定的文件。
/R和/W开关允许您更改此行为。
如果这里有附加文件的方法,我可以分享我的结果。
我还在测试中包括了FastCopy和Windows,每个测试都运行了10次。注意,这些差异是相当显著的。95%置信区间无重叠。
https://stackoverflow.com/questions/24121046
复制相似问题