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.

Related posts:

  1. Windows batch file to delete old files and remove empty directories recursively
  2. Windows 7: How to edit hosts file
  3. Windows: Android SDK installer does not find Java SE Development Kit (JDK)
  4. Windows 7: Install service to run Razuna 1.4 automatically
  5. CrashPlan PRO & Windows: How to connect to a remote (headless) CrashPlan PRO client running on Linux

Leave a comment

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

*

*