windows cmd command - syntax error

0

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

   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.

i cannot seem to get it work, help pls.

syntax
cmd
robocopy
asked on Stack Overflow Mar 15, 2011 by Andre • edited Mar 15, 2011 by atzz

2 Answers

0

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
answered on Stack Overflow Mar 15, 2011 by Benoit • edited Mar 15, 2011 by Benoit
0

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

answered on Stack Overflow Mar 15, 2011 by atzz

User contributions licensed under CC BY-SA 3.0