当我的 robocopy 路径中有空格时,我用“将其包围,但出现下面奇怪的错误......
我的.bat 文件包含:
rem Backup scans
ROBOCOPY "C:\Users\doug\Documents\My Scans\" "B:\BACKUP\My Scans\" /e /NFL /NDL
pause
我收到此错误:
C:\Windows\system32>rem Backup scans
C:\Windows\system32>ROBOCOPY "C:\Users\doug\Documents\My Scans\" "B:\BACKUP\My
Scans\" /e /NFL /NDL
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Thu Jun 23 19:32:29 2016
Source : C:\Users\doug\Documents\My Scans" B:\BACKUP\My\
Dest : C:\Windows\system32\Scans"\
Files : *.*
Options : *.* /NDL /NFL /S /E /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
2016/06/23 19:32:29 ERROR 123 (0x0000007B) Accessing Source Directory C:\Users\d
oug\Documents\My Scans" B:\BACKUP\My\
The filename, directory name, or volume label syntax is incorrect.
C:\Windows\system32>pause
Press any key to continue . . .
答案1
在您的命令中,ROBOCOPY "C:\Users\doug\Documents\My Scans\" "B:\BACKUP\My Scans\" /e /NFL /NDL
结尾的斜杠是对双引号符号的转义。Robocopy 随后会假定它是一个完整参数,但它找不到它。请尝试以下方法之一:
ROBOCOPY "C:/Users/doug/Documents/My Scans/" "B:/BACKUP/My Scans/" /e /NFL /NDL
ROBOCOPY "C:\Users\doug\Documents\My Scans\\" "B:\BACKUP\My Scans\\" /e /NFL /NDL
ROBOCOPY "C:\Users\doug\Documents\My Scans" "B:\BACKUP\My Scans" /e /NFL /NDL
答案2
删除源和目标末尾的反斜杠。
“C:\Users\doug\Documents\我的扫描” “B:\BACKUP\我的扫描”
编辑:不知怎的,Blerg 抢先了一步。他说了什么。