Windows findstr - sort of a bit like grep

19 Nov 2022

If you don’t have UnxUtils and you don’t have Cygwin and you don’t want to use PowerShell and you just want to use the standard Windows command prompt…

A basic starter command:

1
findstr /SPIN /C:"foo" *

…where:

/S - search subdirectories
/P - skip binary files
/I - case-insensitive searching
/N - show line numbers of matches
C:"foo" - search for the literal string foo (no regex)
* - search all files

From there you can use findstr /? for more help - such as /r for regex support.

Another useful one, where /M only prints the file name:

1
findstr /SPIM /C:"foo" *