Take the 2-minute tour ×

I had to switch off my windows search indexing in Win 7 as the old hard disk was constantly making noise with indexing switched on!

Now I want to use MS-DOS to search for a specific text term within all files located within the current directory and sub directories

how do i use the ms-dos command findstr to search subdirectories?

currently, when i open a command prompt and change directory to the following subfolder (C:\Users\Damien\Documents\Research\2012July) and run the command (findstr "thesis" *.tex /S)

I get the following error :

FINDSTR: Cannot open /s

This command will search the current directory if I remove /S, but I want to be able to search for text within subfolders also.

many thanks,


share|improve this question
Posting as comment, since I know this isn't the answer you want, but: install Cygwin (www.cygwin.org) and you'll have a full set of consistent, functional, well-documented command-line tools that always just work. The UNIX find command is infinitely more flexible and powerful -- and of course can do what you want here. –  Ernest Friedman-Hill Feb 1 '12 at 14:04
add comment

2 Answers

You need to put /S at the beginning, ie:

findstr /S "thesis" *.tex

C:\>findstr /?
Searches for strings in files.


Your modifiers/switches whatever they are called need to come before your pattern/string

share|improve this answer
thanks all this is great ! –  DeadlyDee Feb 2 '12 at 12:59
You're very welcome –  Jon Feb 2 '12 at 14:11
@Jon How would I structure the syntax if I also want to indicate the path (i.e. findstr /S "some_string" *.txt PATH?) where and how would I indicate the path for the folder with the sub-folders I want to search. Thank you –  IberoMedia Oct 16 '13 at 6:14
cd into dir first and use /S, or look at the docs for /D –  Jon Oct 16 '13 at 9:31
add comment

You have your arguments in the wrong order, try findstr /S "thesis" *.tex

share|improve this answer
add comment

Your Answer


