-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.

0

1 Answer 1

1

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

FORFILES /M * /C "cmd /c if @isdir==FALSE testscript.exe @file"
Sign up to request clarification or add additional context in comments.

2 Comments

this kinda works, can you only print out the files that have errors. Errors would have this text in it "invalid"
@user1471980: you can add a | findstr "invalid" at the end, this filters the output on that particular word.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.