DOS file content search command

A seemingly simple task that I could not get Windows XP search function to perform. Here is a command for creating a result where you want to search a big directory of subdirectories and files for a certain string or content with the help of DOS.

Enter this in the main directory of your search:

for /F "usebackq" %i in (`dir /b /s *.asp`) do find /N "John Wayne" %i >> searchresult.txt


Where you change the following values to make your search:

*.asp with the type of files you want to search through, e.g. *.* (all files), *.txt (all text files).

"John Wayne" with the search term you want to search for within the files.

searchresult.txt with the file you would like to save your result in.

Written by: Dag Jonny Nedrelid
©2007-2012 http://thronic.com


Feel free to leave a comment.
Name:
URL:
0