0

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?

benPearce
  • 321
  • 5
  • 11

2 Answers2

4

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

Mark Ingalls
  • 246
  • 1
  • 3
2

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
Neobyte
  • 3,179
  • 1
  • 26
  • 31