The backslash is treated as an escape character in this case because it immediately precedes the closing "
. If you append a .
to the path, the result will be the same path but the backslash will no longer precede the closing "
and therefore will not be treated as an escape character for the ending quote.
In the example you've posted both the source and target paths end with a \
. Therefore you'll need to add a .
to both:
for /f "delims=" %%a in (C:\audit\test.txt) do (
robocopy "%%~dpa." "Z:\." "%%~nxa" /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30
)
pause