开发者

windows cmd command - syntax error

i'm getting error when running this command:

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

   So开发者_JAVA百科urce : 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.

i cannot seem to get it work, help pls.


Your problem is caused by the fact that a double-quote preceded by a backslash is interpreted as an escaped double-quote... sometimes.

See this article by Raymond Chen: What's up with the strange treatment of quotation marks and backslashes by CommandLineToArgvW


When parsing the command line, some commands treat \" as an escaped ".

You should double your backslash.

Also see This reference regarding the MSVCRT (a dependency walker shows robocopy uses the MSVCRT).

Let me suggest:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜