Windows: Search for strings in files recursively

Recently, I found the findstr command on Windows system which can be used to search for strings in files (similar to find combined with grep on Unix). Here is an example that searches for the string “hello world” in all files in the current working directory and all subdirectories (parameter /s specifies recursive search):

> findstr /s /C:"hello world" *

Other useful parameters are /i (search case-insensitive), /p (skip binary files), /n (print line number for matches) which can refine the search:

> findstr /snip /C:"hello world" *

Findstr also supports regular expressions. A complete list of all parameters can be found in the MSDN library.


Leave a Reply

Your email address will not be published. Required fields are marked *