Package for loop using parenthesis in command

I have a batch file with the following code:

for /f "tokens=*" %%a in ('dir /b /a-d') do (
 echo Processing %%a >>%LOG%
 dtsrun /S(local) /NNotesLoad /A"FilePath:8="%NOTESDIR%\%%a" /AClientID=%1 >>%LOG%

 echo Deleting %%a >>%LOG%
 del %%a /q
)

At this time, the error message “/ NNotesLoad was unexpected” is returned because the second bracket effectively closes the FOR block.

I need to leave (local) as the / S option.
How to avoid brackets in dtsrun line?

EDIT: Turns out you can specify the server in dtsrun for local as.

But I would still like to respond to parentheses escaping.

+3
source share
1 answer

The solution for escaping parentheses is a prefix with a carriage ^

Therefore, he will read:

/S^(local^)
+4
source

Source: https://habr.com/ru/post/1709254/


All Articles