Steffen - 2019-10-06

If you want to use DirEvents in a Batch script I strongly recommend to download the example scripts along with the DirEvents binary. You can't use DirEvents in a FOR /F loop because it is buffering the records and doesn't begin to iterate. You have to work around using SET /P like that

DirEvents "C:\" /s | (cmd /von /q /d /c ^"for /l %%# in (^) do set "rec="^&set /p "rec="^&(if not defined rec exit^)^&^
  echo work with '!rec!' here^
")

Replace the echo line with your code. Note that the processing of the records is done in command-line mode. You have to concatenate commands using &. If you want to write your code in multiple lines (as I did above) you have to escape line ends using ^.