Search for Text Inside a Group of Files
If you need to search a group of files for a certain string of text, place the below script in a *.CMD file which resides in the same folder as all the files you would like to search. The results will output in a file called “Results.txt”.
@ECHO OFF REM Source: http://wp.me/p6h4z-1q REM Searches for strings in files. REM FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file] REM [/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]] REM strings [[drive:][path]filename[ ...]] REM /B Matches pattern if at the beginning of a line. REM /N Prints the line number before each line that matches. REM * Wildcard: any character ECHO Searches all files in the current directory for the text, "Error", at the ECHO beginning of the line and saves where the text is located in a text file ECHO called "Results.txt". ECHO. ECHO Warning: This file cannot be run on a UNC path. Please map the location ECHO to a drive letter before executing this file. ECHO. PAUSE findstr /N /B "Error" * > Results.txt ECHO. ECHO *** Search Process Completed *** ECHO. Start Notepad.exe Results.txt PAUSE