xcopy的用法
XCOPY source ] ] <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" /><a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
[/-Y] <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
[+file3]...]<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
source 指定要复制的文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
destination 指定新文件的位置和/或名称。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/A 只复制有存档属性集的文件,但不改变属性。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/M 只复制有存档属性集的文件,并关闭存档属性。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/D:m-d-y 复制在指定日期或指定日期以后改变的文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
如果没有提供日期,只复制那些源时间比目标时间新的文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/EXCLUDE:file1[+file2][+file3]...<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
指定含有字符串的文件列表。如果有任何字符串与要被复制的文件<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
的绝对路径相符,那个文件将不会得到复制。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
例如,指定如 \obj\ 或 .obj 的字符串会排除目录 obj 下面的<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
所有文件或带有 .obj 扩展名的文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/P 创建每个目标文件前提示。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/S 复制目录和子目录,除了空的。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/E 复制目录和子目录,包括空的。与 /S /E 相同。可以用来修改 /T。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/V 验证每个新文件的大小。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/W 提示您在复制前按键。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/C 即使有错误,也继续复制。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/I 如果目标不存在,又在复制一个以上的文件,则假定目标一定是一<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
个目录。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/Q 复制时不显示文件名。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/F 复制时显示完整的源和目标文件名。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/L 显示要复制的文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/G 允许将没有经过加密的文件复制到不支持加密的目标。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/H 也复制隐藏和系统文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/R 覆盖只读文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/T 创建目录结构,但不复制文件。不包括空目录或子目录。/T /E 包<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
括空目录和子目录。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/U 只复制已经存在于目标中的文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/K 复制属性。一般的 Xcopy 会重设只读属性。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/N 用生成的短名复制。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/O 复制文件所有权和 ACL 信息。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/X 复制文件审核设置(隐含 /O)。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/Y 禁止提示以确认覆盖一个现存目标文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/-Y 导致提示以确认覆盖一个现存目标文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/Z 用重新启动模式复制网络文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
命令行开关 /Y 可以预先在 COPYCMD 环境变量中设置。这可能被命令行上的 /-Y<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
覆盖。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
=========================================<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
Xcopy<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制文件和目录,包括子目录。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
语法<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
xcopySource ] ] [{/a | /m}] ][+] [{/y | /-y}] <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
参数<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
Source<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
必需。指定要复制的文件的位置和名称。该参数必须包含驱动器或路径。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
Destination<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
指定要复制的文件的目标。该参数可以包含驱动器号和冒号、目录名、文件名或者它们的组合。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/w<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
在开始复制文件之前将显示以下消息并等待您的响应:<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
Press any key to begin copying file(s) <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/p<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
提示您确认是否要创建每个目标文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/c<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
忽略错误。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/v <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
在写入目标文件时验证每个文件,以确保目标文件与源文件完全相同。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/q<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
禁止显示“xcopy”的消息。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/f<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制时显示源文件名和目标文件名。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/l<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
显示要复制的文件列表。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/g<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
创建已解密的目标文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/d [:MM-DD-YYYY] <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
只复制那些在指定日期或指定日期之后更改过的源文件。如果不包括“MM-DD-YYYY”值,“xcopy”会复制比现有“Destination”文件新的所有“Source”文件。该命令行选项使您可以更新更改过的文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/u<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
只从“Source”复制“Destination”中已有的文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/i<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
如果“Source”是一个目录或包含通配符,而“Destination”不存在,“xcopy”会假定“destination”指定目录名并创建一个新目录。然后,“xcopy”会将所有指定文件复制到新目录中。默认情况下,“xcopy”将提示您指定“Destination”是文件还是目录。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/s<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制非空的目录和子目录。如果省略“/s”,则“xcopy”将在单个目录中工作。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/e<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制所有子目录,包括空目录。将“/e”与“/s”和“/t”命令行选项一起使用。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/t<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
只复制子目录结构(即目录树),不复制文件。要复制空目录,必须包含“/e”命令行选项。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/k<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制文件,如果源文件具有只读属性,则在目标文件中保留该属性。默认情况下,“xcopy”将删除只读属性。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/r<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制只读文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/h<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制具有隐藏和系统文件属性的文件。默认情况下,“xcopy”不复制隐藏或系统文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/a<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
只复制那些具有存档文件属性设置的源文件。“/a”不修改源文件的存档文件属性。有关如何通过使用“attrib”来设置存档文件属性的信息,请参阅“相关主题”。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/m<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制具有存档文件属性设置的源文件。与“/a”不同,“/m”关闭在源中指定的文件的存档文件属性。有关如何通过使用“attrib”来设置存档文件属性的信息,请参阅“相关主题”。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/n<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
使用 NTFS 短文件或目录名创建副本。将文件或目录从 NTFS 卷复制到 FAT 卷或者当目标文件系统需要 FAT 文件系统命名约定(即 8.3 字符)时,需要“/n”。目标文件系统可以是 FAT 或 NTFS。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/o<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制文件所有权与随机访问控制列表 (DACL) 信息。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/x<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
复制文件审核设置和系统访问控制列表 (SACL) 信息(包含“/o”)。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/exclude:FileName1[+[ FileName2]][+] <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
指定包含字符串的文件列表。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/y<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
禁止提示确认要覆盖已存在的目标文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/-y<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
提示您确认要覆盖已存在的目标文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/z<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
在可重启模式中通过网络复制。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
/?<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
在命令提示符显示帮助。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
注释<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• 使用“/v”<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
Windows XP 和 Windows Server 2003 家族产品不使用该命令。只为了与现有的 MS-DOS 文件保持兼容性才包含此命令,但是因为其功能是自动实现的,所以在命令行使用时不起作用。 <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• 使用“/exclude”<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
在每个文件的单独一行中的列出每个字符串。如果列出的任何字符串与要复制的文件的绝对路径的任何部分匹配,就从复制进程排除该文件。例如,如果指定字符串 "\Obj\",则会排除 Obj 目录下的所有文件。如果指定字符串 ".obj",则排除具有 .obj 扩展名的所有文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• 使用“/z”<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
如果在复制过程中丢失连接(例如,如果用于连接的服务器脱机),复制过程将在重新建立连接后恢复。“/z”也显示每个文件完成的复制操作的百分比。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• 在 COPYCMD 环境变量中使用“/y” <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
可在 COPYCMD 环境变量中使用“/y”。在命令行上使用“/-y”可以覆盖该命令。默认情况下,会提示您覆盖,除非您从批处理脚本内运行“copy”。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• 复制加密的文件 <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
将加密文件复制到不支持 EFS 的卷会导致错误。应首先解密文件或将文件复制到支持 EFS 的卷中。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• 追加文件 <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要追加文件,请指定单个目标文件,多个源文件(使用通配符或 file1+file2+file3 格式)。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• “Destination”的默认值<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
如果省略“Destination”,则“xcopy”命令将文件复制到当前目录。 <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• 指定“Destination”是文件还是目录 <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
如果“Destination”不包含现有目录且不以反斜杠 (\) 结尾,会出现下列消息: <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
Does destination specify a file name or directory name on the target (F = file, D = directory)?<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
如果要将一个或多个文件复制到一个文件,请按 F。如果要将一个或多个文件复制到一个目录,请按 D。 <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
使用“/i”命令行选项可禁止显示该消息,从而导致“xcopy”认定在源是多个文件或一个目录的情况下,目标是一个目录。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• 使用“xcopy”命令设置“Destination”文件的存档属性 <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
“xcopy”命令创建具有存档属性设置的文件,无论源文件中是否设定了此属性。有关文件属性和“attrib”的详细信息,请参阅“相关主题”。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• 比较“xcopy”和“diskcopy”<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
如果磁盘的子目录中包含文件,要将其复制到具有不同格式的磁盘中,请使用“xcopy”命令,而不要使用“diskcopy”。因为“diskcopy”命令是一个磁道接一个磁道地复制磁盘,所以需要源磁盘和目标磁盘的格式必须相同。“xcopy”命令没有这个要求。通常情况下请使用“xcopy”,除非您需要完整的磁盘映像副本。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
• “xcopy”的退出代码<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要处理“xcopy”返回的退出代码,请在批处理程序的“if”命令行上使用“ErrorLevel”参数。有关使用“if”处理退出码的批处理程序的示例,请参阅“相关主题”。下表列出每一个退出代码和描述。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
退出代码 描述 <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
0<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
文件复制没有错误。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
1<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
没有找到要复制的文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
2<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
用户按 Ctrl+C 终止了“xcopy”。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
4<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
出现了初始化错误。没有足够的内存或磁盘空间,或命令行上输入了无效的驱动器名称或语法。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
5<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
出现了磁盘写入错误。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
示例<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要从驱动器 A 将所有文件和子目录(包括所有空的子目录)复制到驱动器 B,请键入: <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
xcopy a: b: /s /e <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要包含上一示例中的任何系统或隐藏文件,请按如下所示添加“/h”命令行选项:<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
xcopy a: b: /s /e /h<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要使用 \Rawdata 目录中 1993 年 12 月 29 日后更改的文件更新 \Reports 目录中的文件,请键入: <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
xcopy \rawdata \reports /d:12-29-1993<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要更新上例中 \Reports 中存在的所有文件而不考虑日期,请键入:<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
xcopy \rawdata \reports /u<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要获得前一个命令要复制的文件列表而不实际复制文件,请键入:<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
xcopy \rawdata \reports /d:12-29-1993 /l > xcopy.out<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
文件 Xcopy.out 列出了要复制的所有文件。<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要将 \Customer 目录及其所有子目录复制到网络驱动器 H: 上的目录 \\Public\Address,保留只读属性,并在 H: 上创建新文件时对您做出提示,请键入:<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
xcopy \customer h:\public\address /s /e /k /p<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要发出上一个命令,确保在 \Address 目录不存在时“xcopy”会创建该目录,并禁止显示创建新目录时出现的消息,请按如下所示添加“/i”命令行选项:<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
xcopy \customer h:\public\address /s /e /k /p /i<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
可以创建批处理程序执行“xcopy”操作,并且使用“if”批处理命令在发生错误时处理退出代码。例如,以下的批处理程序使用了可替换的“xcopy”源和目标参数: <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
@echo off rem COPYIT.BAT transfers all files in all subdirectories of rem the source drive or directory (%1) to the destinationrem drive or directory (%2)xcopy %1 %2 /s /eif errorlevel 4 goto lowmemory if errorlevel 2 goto abort if errorlevel 0 goto exit :lowmemory echo Insufficient memory to copy files or echo invalid drive or command-line syntax. goto exit:abort echo You pressed CTRL+C to end the copy operation. goto exit :exit <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
要使用该批处理程序将 C:\Prgmcode 目录及其子目录中的所有文件复制到驱动器 B 中,请键入: <a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
copyit c:\prgmcode b:<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
<a href="http://www.lc365.net/" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" target="_blank" />
该命令解释程序将用“C:\Prgmcode”替换“%1”,用“B:”替换“%2”,然后执行带“/e”和“/s”命令行选项的“xcopy”。如果“xcopy”遇到错误,批处理程序将读取退出码并转到相应“IF ERRORLEVEL”语句中指示的标签,然后显示相应的消息并退出批处理程序
页:
[1]