For loop in batch file error: Do was unexpected at this time

batch-file

Solution

in batch use `%%i`, whereas in command line use `%i`

Problem

I am trying to execute following command using batch file: ``` for /f %i in (D:\random\servers.txt) DO (d:\utils\tail -60 \\%i\c$\Windows\windowsUpdate.log | d:\utils\grep "updates detected" & set tx1234=%i) ``` It works when being invoked on its own in command prompt but as soon as I would save it within batch file it fails with the message Do was unexpected at this time Any ideas?

Original source