Skip to main content

Use the findstr command in Windows to find specified text/string within one or more files.

:: To find space-separated string(s) in all files:
findstr "<query>" *

:: To find space-separated string(s) in a piped command's output:
<dir> | findstr "<query>"

:: To find space-separated string(s) in all files recur[s]ively:
findstr /s "<query>" *

:: To find strings using a case-insensitive search:
findstr /i "<query>" *"

:: To find strings in all files using regular expressions:
findstr /r "<expression>" *

:: To find a literal string (containing spaces) in all text files:
findstr /c:"<query>" *.txt

:: To display the line number before each matching line:
findstr /n "<query>" *

:: To display only the filenames that contain a match:
findstr /m "<query>" *