运行此命令时出错:
for /f "delims=|" %f in ('dir /b y:\db\b') do "Y:\robocopy.exe" "y:\db\b\%f\" "y:\db\a\%f\Certificates and deliverables\" /e
"Y:\robocopy.exe" "y:\db\b\a 001\" "y:\db\a\a 001\Certificates and deliverables\" /e
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows :: Version XP010
-------------------------------------------------------------------------------
Started : Tue Mar 15 14:06:41 2011
Source : y:\db\b\a 001" y:\db\a\a\
Dest : y:\db\b\001\Certificates\
Files : and
deliverables"
Options : /S /E /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
2011/03/15 14:06:41 ERROR 123 (0x0000007B) Accessing Source Directory y:\db\b\a 001" y:\db\a\a\
The filename, directory name, or volume label syntax is incorrect.
我似乎无法让它工作,请帮忙。
答案 0 :(得分:0)
在解析命令行时,某些命令将\"
视为转义"
。
你应该加倍反斜杠。
另请参阅This reference有关MSVCRT(依赖性walker显示robocopy使用MSVCRT)。
我建议:
for /f "delims=|" %f in ('dir /b y:\db\b') do "Y:\robocopy.exe" "y:\db\b\%f\\" "y:\db\a\%f\Certificates and deliverables\" /e
答案 1 :(得分:0)
你的问题是由于反斜杠前面的双引号被解释为转义的双引号......有时会引起你的问题。
请参阅Raymond Chen撰写的这篇文章:What's up with the strange treatment of quotation marks and backslashes by CommandLineToArgvW