Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I search for a keyword in all the text files from a folder? I am using Vista.

share|improve this question

5 Answers 5

%> findstr 'keyword' *.txt

share|improve this answer

In addition to the answers on this question,
I can also recommend Agent Ransack:

Agent Ransack is a free tool for finding files and information on your hard drive fast and efficiently. When searching the contents of files Agent Ransack displays the text found so you can quickly browse the results without having to separately open each file!

Agent Ransack provides compelling advantages over similar search tools:

  • Regular expressions that allow complex rule based searches.
  • Immediate contents results view.
  • Various wizards to walk the user through the searching process.
share|improve this answer

Even better: Microsoft or Google Desktop Search (Free Software by M$ and Google).

They are able to index all sort of files (even pdf, doc, xls and that like).

So you can query the index instead of time-wasting searching with the con of having/building a large index and updating it.

share|improve this answer

To search files by file contents you must first enable it, since by default it's only enabled in indexed locations:

  • open any folder
  • menu Tools -> Folder Options
  • select tab Search, enable Always search file names and contents (might be slow)
  • press OK

To search:

  • go to the folder where you want to search
  • in search box type 'ext:txt keyword' (without quotes)

This will search for word keyword in all file names and contents in txt files. Keyword must be a separate word. To also include cases where keyword is part of a word (either in contents or file name) use wildcards like this

ext:c *keyword*
share|improve this answer

The findstr may be extremely helpful, but the most powerful tool you're looking for here may be grep.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.