2011-03-15 103 views
0

运行此命令时,我得到错误:窗口cmd命令 - 语法错误

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

解析命令行时,某些命令将\"视为转义的"

你应该加倍你的反斜杠。

另请参阅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 
+0

好吧,它应该是什么? – Andre 2011-03-15 14:37:57

+0

@Andre:我承认这真的很棘手......这是一个示例命令行来做到这一点。 – Benoit 2011-03-15 14:44:09