-3

I am trying to execute a windows script against bunch of files in a directory. This script checks the format of the files it it is not good, I need to write to the log.txt file so that I can go back and fix each file.

I tried this:

for /f "Tokens=*" %f in ('dir /l/b/a-d') do (testscript -l "%f") >>logs.txt

I need to now the file names as well.

aschipfl
  • 31,767
  • 12
  • 51
  • 89
user1471980
  • 10,383
  • 47
  • 132
  • 225

1 Answers1

1

The last line of forfiles /? shows something similar to this:

FORFILES /M * /C "cmd /c if @isdir==FALSE testscript.exe @file"
Gerhard
  • 21,163
  • 7
  • 24
  • 41
Dominique
  • 13,061
  • 14
  • 45
  • 83
  • this kinda works, can you only print out the files that have errors. Errors would have this text in it "invalid" – user1471980 Oct 22 '20 at 20:16
  • @user1471980: you can add a `| findstr "invalid"` at the end, this filters the output on that particular word. – Dominique Oct 23 '20 at 14:40