首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >X拷贝与机器人复制的区别

X拷贝与机器人复制的区别
EN

Stack Overflow用户
提问于 2014-06-09 13:09:58
回答 6查看 150.2K关注 0票数 76

我对批处理脚本有点陌生。作为一名新手,我发现这两种方法都很有用,在编写脚本时,x拷贝和机器人拷贝之间的主要区别是什么?

EN

回答 6

Stack Overflow用户

回答已采纳

发布于 2014-06-09 13:21:18

在新版本的windows中,Robocopy取代了XCopy。

  1. 使用镜像,XCopy不使用
  2. 有一个/RH选项,允许运行副本的设定时间。
  3. 有一个/MON:n选项来检查文件中的差异
  4. 复制比XCopy更多的文件属性

是的,我同意马克·塞切尔的观点,他们都是垃圾。(微软带给你的)

更新:

XCopy返回代码:

代码语言:javascript
运行
复制
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.

机器人返回代码:

代码语言:javascript
运行
复制
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

票数 77
EN

Stack Overflow用户

发布于 2014-06-10 03:09:13

最重要的区别是,当发生错误时,robocopy (通常)会重试,而xcopy则不会。在大多数情况下,这使得robocopy更适合在脚本中使用。

增编:为了完整起见,机器人复制有一个已知的边缘问题;如果这是一个问题,您可能需要查看第三方工具,或者编写自己的工具。

票数 19
EN

Stack Overflow用户

发布于 2016-08-15 20:16:37

我能看到的不同之处是,Robocopy有更多的选择,但我发现它们中的任何一个都没有特别的帮助,除非我正在做一些特别的事情。

我对几个复制例程做了一些基准测试,发现XCOPY和Robocopy是最快的,但令我惊讶的是,XCOPY始终在ROBOCOPY之外。

具有讽刺意味的是,机器人复制重新尝试了一个失败的副本,但它也在我的基准测试中失败了很多,而xcopy从来没有成功过。

在我的基准测试之后,我对完整文件(逐字节)文件进行了比较。

下面是我在测试中使用的用于机器人复制的开关:

代码语言:javascript
运行
复制
 **"/E /R:1 /W:1 /NP /NFL /NDL"**.  

如果有人知道一个更快的组合(除了删除/E,我需要),我很想听听。

机器人复制的另一个有趣/令人失望的事情是,如果一个拷贝确实失败了,默认情况下,它会在每次尝试之间延迟30秒重试100万次。如果您正在运行一个长批处理文件,您可能会非常失望,当您回来几个小时后,发现它仍然试图复制一个特定的文件。

/R和/W开关允许您更改此行为。

  • 使用/R,您可以告诉它要重试多少次,
  • /W,让我们指定重试之前的等待时间。

如果这里有附加文件的方法,我可以分享我的结果。

  • 我的测试都是在同一台电脑上完成的
  • 将文件从一个外部驱动器复制到另一个外部驱动器,
  • 都在USB3.0端口上。

我还在测试中包括了FastCopy和Windows,每个测试都运行了10次。注意,这些差异是相当显著的。95%置信区间无重叠。

票数 12
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24121046

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档