Findstr to Scan Text File for String or Compare Two Files

email me

Find a String in Text File

findstr /c:YourStringHere FileNameHere.txt && Echo TRUE || Echo FALSE

* you can change the echos to subroutines, and make this pretty powerful

 

Compare Two Files

The fastest method to diff two files is to use findstr command. It will compare and return the result to a new file.

findstr /vixg:C:\FILE1.txt C:\FILE2.txt > C:\FILE3.txt

Notes

/v : Prints only lines that do not contain a match.
/i : Specifies that the search is not to be case-sensitive.
/x : Prints lines that match exactly.
/g: file : Gets search strings from the specified file.