How To Search For Words Inside Text Files on Windows 7

This is one of those little tricks that are needed much more often that you might think. It’s extremely useful and will save you tons of time.

How do you search for a specific word or sentence across thousands of documents on your computer? How do you search for text, not only by file name, but inside the files themselves? This is also useful for when you want to find a file whose contents you know, but you forgot its file name.

In Windows 7, there is a feature that lets you search documents for text or a phrase within them.

You can find all documents that contain a word or sentence you’re looking for.

You can look for a specific keyword or phrase inside many different file formats. Search across and inside PDF documents, Word documents, txt files, and even .js, .php, .cpp, .dat, .log, .ini files. Basically, it will look inside all files that contain some kind of text written with letters (is that general enough?).

The best part is that it is extremely easy. There’s no need for downloading and installing third-party search tools. You simply use the Windows 7 native search feature which you can find in every window of any folder you open (also called “Windows Explorer”).

Using Windows Search to find words inside text documents

Let’s see how to do this, in a traditional Gnoted way, step by step, with screenshots to illustrate every step along the way.

First, for those unfamiliar with it, the Windows Search tool can be located in any window of any folder you open. Nothing special about it.

Windows 7 Search tool location

Now, if you want to narrow your search to one specific folder and documents inside it, then simply open that folder and cotninue as described here. If you want to search the entire system, then you might want to open “My Computer”, and use this tool right there, so it will search the entire system. The process is the same.

Here’s the catch. Instead of typing the actual name of the document you want to find (we want to search inside documents, remember?), you type your search query like this:

content: “Keyword or phrase you want to find”

The quotation marks are required if you’re searching for more than one word. In the screenshot below you can see exactly how I searched for “John Smith” using the query format specified above.

Search inside text files in Windows

In the results I can see which documents contain the keyword or phrase I searched for. As you can see, the results include various document types such as Word documents, txt documents and even Power Point presentation file. It searches through all of them.

Another nice thing about the results is that, below the file name, it will display a short portion of the text where the words you were searching for were found (screenshot above). That way, you know exactly where that word is located if the document has many pages and lots of text.

This little trick is a life saver when you really need it. Do you know any more tricks for searching inside Windows? Share them with everyone in the comments below.

Also, if you are interested in more advanced things about Windows Search, I definitely recommend Microsoft’s official page on using search filters. It has some additional tips.

Popular Posts:

3 Responses
  • yunda Reply

    Very nice information. Thanks for this. At present i am using Text Finding, which is also a wonderful tool to search for words tnside text files on all windows platforms. I like Text Finding a lot!

  • Doug Reply

    Can you tell me how to do the same thing in Windows XP? I hate that Microsoft got rid of the “Search Companion”! Argh.
    This search method is CRUCIAL to my work & I can only do it on my 12 year old laptop at my desk.

  • Paul ROBERTSON Reply

    The performance of this search tool seems at best to be very variable, and if you can’t rely on it, what use is it? I agree with ‘Doug.’ I eventually gave up and wrote a simple DOS script to do the job. A script has the advantage of running much faster than the GUI tool (when it deigns to work).

    Basically you have to encapsulate this in a script that will launch in the appropriate DOS environment:

    set /p sequence=enter string to be found:
    findstr /S /I /C:%sequence% *.*


Leave a Reply