首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Robocopy -排除大量目录

Robocopy -排除大量目录
EN

Stack Overflow用户
提问于 2014-07-22 01:20:28
回答 4查看 61.3K关注 0票数 14

我对机器复制有问题。我想用它来备份系统盘,并且我想排除一些系统文件夹。但它仍在尝试复制其中的一些文件夹。我的批处理文件是:

代码语言:javascript
复制
robocopy c:\ l:\C\ /r:1 /w:1 /mir /dcopy:T /xjd /xjf /xj /copy:DT /log+: l:\RobocopyLogC.txt /xf "desktop.ini" /xd "$Recycle.Bin" /xd Config.Msi /xd MSOCache/xd Recovery /xd "System Volume Information" /xd Windows /xd "Program Files\Common Files" /xd "Program Files\Internet Explorer" /xd "Program Files\Reference Assemblies" /xd "Program Files\Uninstall Information" /xd "Program Files\Microsoft Analysis Services" /xd "Program Files\Microsoft Mouse and Keyboard Center" /xd "Program Files\Microsoft Office" /xd "Program Files\Microsoft Silverlight" /xd "Program Files\MSBuild" /xd "Program Files\Windows Defender" /xd "Program Files\Windows Journal" /xd "Program Files\Windows Mail" /xd "Program Files\Windows Media Player" /xd "Program Files\Windows Multimedia Platform" /xd "Program Files\Windows NT" /xd "Program Files\Windows Photo Viewer" /xd "Program Files\Windows Portable Devices" /xd "Program Files\Windows Sidebar" /xd "Program Files\WindowsApps" /xd "Program Files\WindowsPowerShell" /xd "Program Files (x86)\Common Files" /xd "Program Files (x86)\InstallShield Installation Information" /xd "Program Files (x86)\Internet Explorer" /xd "Program Files (x86)\Microsoft Analysis Services" /xd "Program Files (x86)\Microsoft Office" /xd "Program Files (x86)\Microsoft Silverlight" /xd "Program Files (x86)\Microsoft.NET" /xd "Program Files (x86)\MSBuild" /xd "Program Files (x86)\Reference Assemblies" /xd "Program Files (x86)\Temp" /xd "Program Files (x86)\Windows Defender" /xd "Program Files (x86)\Windows Mail" /xd "Program Files (x86)\Windows Media Player" /xd "Program Files (x86)\Windows Multimedia Platform" /xd "Program Files (x86)\Windows NT" /xd "Program Files (x86)\Windows Photo Viewer" /xd "Program Files (x86)\Windows Portable Devices" /xd "Program Files (x86)\WindowsPowerShell" /xd "Program Files (x86)\Windows Sidebar" /xd ProgramData\Microsoft /xd "ProgramData\Microsoft Help" /xd "ProgramData\Package Cache" /xd Users\Public /xd Users\Default /xd Users\userName2 /xd Users\userName\AppData\LocalLow\Temp /xd Users\userName\AppData\Local\Temp

我试过很多方法,但都没有用。你能帮帮我吗?

EN

回答 4

Stack Overflow用户

发布于 2015-01-29 22:06:08

不要使用多个/xd!只需设置第一个/xd后面的所有目录

代码语言:javascript
复制
... /xd "dir1" "dir2" "dir3" ...
票数 29
EN

Stack Overflow用户

发布于 2015-11-19 12:03:02

/xd选项似乎不能很好地处理相对路径。尝试使用绝对路径,例如,

代码语言:javascript
复制
robocopy c:\ l:\C\ /r:1 /w:1 /mir /dcopy:T /xjd /xjf /xj /copy:DT ... 
   /xd "C:\$Recycle.Bin" 
   /xd C:\Config.Msi 
   /xd C:\MSOCache
   /xd C:\Recovery 
   /xd "C:\System Volume Information" 

(拆分以提高可读性。)

票数 6
EN

Stack Overflow用户

发布于 2018-12-28 21:12:16

在路径中替换双引号(例如"C:\$Recycle.Bin")和一个单引号('C:\$Recycle.Bin')。这是因为美元字符"$“开始变量,并被解释为名为"$Recycle”的变量。

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

https://stackoverflow.com/questions/24870973

复制
相关文章

相似问题

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