Im trying to write a batch file which scans several files and looks for the string “WARNING“.
So far I have:
FORFILES -m*.f08 -C"CMD /C FINDSTR /N "WARNING" ECHO @FILE >> ListOfWARNINGS
Problem one: It does not print each found string in a new line.
Problem two: How can I change the code and add a IF statement so that it also prints the line following the line where WARNING was found.
I think that for getting the next line your actually going to have to loop the files & content as neither forfiles nor find support this as far as I know;
Here
if not !line!==!line:WARNING=X!detects a match by asking if a line is equal to itself after WARNING is replaced with X.