2011-03-15 78 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