Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

This is returning an error message of "/NNotesLoad was unexpected at this time" because the second bracket is effectively closing the FOR block.

I have to leave the (local) as the /S parameter. How do I escape the brackets in the dtsrun line?

share|improve this question
up vote 4 down vote accepted

Try replaceing /S(local) with /S%computername% or /S. or /Slocalhost. All of these should accomplish the same thing w/o using parens.

Alternatively, you can use the caret ^ to escape the parens:

dtsrun /S^(local^) ...

thanks, mark

share|improve this answer
the caret was the solution for escaping the brackets. thanks – benPearce May 28 '09 at 3:07

At the possible loss of some readability, you can put all those commands on the same line and do away with the need for brackets in your for loop.

for blah blah blah do command 1 && command 2 && command 3 && command 4
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.