For a loop in a batch file error: At this time, it was unexpected

I am trying to execute the following command using a 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 it is called on its own on the command line, but as soon as I save it in a batch file, it will fail with a message

It was unexpected at this time

Any ideas?

+6
source share
1 answer

in batch using %%i , while on the command line use %i

+12
source

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


All Articles