Find text in files windows

Description: Learn 3 different methods to search the content of files in Windows 10. You can do it from Windows File Explorer or the command line.

You may have saved a lot of files on your Windows 10 PPC. Normally, you can search files by name to locate a specific file. What if you can’t remember its file name? In that case, you can search the content of files in Windows 10. Here are 3 ways to do it.

You can search through the file content from the Start Menu Search or File Explorer. This feature is disabled by default. You can easily enable it for convenience. If you prefer the command line, you can also search text in files from the command line. Sounds interesting? Keep reading to learn how.

Windows Search Content

As mentioned, it is possible to search file content in Windows 10 from Start Menu Search or File Explorer. If you are unable to do so, then it is because that feature is turned off by default. So, in order to use this feature, you need to enable this feature.

To enable searching content of files in Windows 10:

Step 1. Type “Indexing options” in the Windows Search Bar and select Indexing Options from the results.

Step 2. From the Indexing Options window, click Advanced at the bottom.

Step 3. Under Advanced Options, click on the File types tab. You can see all the extensions are selected by default. If the file extension that you want to search the content of is not listed here, you can add a new extension to the list at the bottom.

Step 4. Check the option Indexed Properties and File contents option and click OK to confirm.

After your confirmation, Windows will start to rebuild indexing. Once complete, you can now locate files through content.

Step 5. Press Windows + E to open File Explorer.

Step 6. Navigate to the directory where you want to start the search. If you have no idea, just click This PC, which will take longer.

Step 7. You will see a search box in the right top corner. Type the text in the search box you want to search the content of the available files. Wait for the results to appear.

The results will include both the content of files and the files name that contain the text that you searched. Most users, if not all, will think the File Explorer search is slow even with index properties only. Now, you are trying to search index properties and file contents, it is going to be even slower. If you want to locate your files faster, keep reading to find better alternatives.

String Search text in files Windows 10 command line

Findstr is a built-in feature in Windows 10 that allows you to locate a file with specific text. You can search individual files or the entire directory with your search query. To learn all the parameters, you can simply run the “findstr /?” command from an elevated command prompt.

You can refer to the steps below to see how it works.

Step 1. Open an elevated command prompt. You can type “CMD” in the windows search bar and press Enter. In the listed results, right-click on Command Prompt and select “Run as an Administrator”.

Step 2. Refer to the syntax to type your command to start the search.

Syntax:

FINDSTR string(s) [pathname(s)]
[/R] [/C:”string”] [/G:StringsFile] [/F:file] [/D:DirList]
[/A:color] [/OFF[LINE]] [options]

Some examples:

Searches the document windows.txt under D:/Documents/ folder for the string “Windows 10”

findstr /c:/documents/ “windows 10” windows.txt

Searches any file under d:\documents for the string “windows”.

findstr “windows” d:\documents\*.*

Search for the occurrence of all words ending with ‘xyz’ in every txt file under D:/Documents/ including all subdirectories.

findstr /R /S [a-z]*xyz d:\documents\*.txt

Useful parameters:

  • /? — display the help text
  • /S — searches the directory and all subdirectories
  • /I — search is not case sensitive
  • /R — use search strings as regular expressions
  • /B — matches patterns at the beginning of lines
  • /P — skip files with non-printable characters

Findstr is quite powerful in terms of searching the content of files because you can search and filter results with the above parameters. You can also use regular expressions and wildcards to match all kinds of situations.

If you don’t know anything about regular expressions and wildcards, I would suggest you try a third-party program Anytxt. It comes with a concise interface and multiple features.

Anytxt

Anytxt Searcher is a free, powerful local document and text search tool for Windows that is much faster than the built-in Windows Search. It works like the local disk version of the Google search engine. It’s the best full-text search engine for desktop files.

With a powerful document parsing engine, Anytxt Searcher can extract any text of common documents without the need for additional software. By harnessing the built-in high-speed indexing system, Anytxt makes it easy to locate any files based on the file content, filename, file type, etc.

Time is precocious. You don’t want to waste it on searching local files, so you should try Anytxt to see how fast it can get your files according to your request. It is completely free without limitations. You can refer to the steps below to see how it works.

Step 1. Free download, and install Anytxt. Click to free download Anytxt.

Step 2. Open Anytxt Searcher, and enter any term in the search box on the left.

Step 3. Click the “+” icon on the top left to filter search directories and file types if needed. Wildcards are supported here.

Step 4. Click the “Go” button on the left, or press Enter to start searching the content of files. Instantly, all the matches files will be listed here.

Hover your mouse on any result for 1 second and it will show you the matched text. Anytxt also offers translation features. In addition, you can also quickly start a Anytext search in File Explorer. You can right on any directory and select “Anytxt Search” to search any content in that directory.

Conclusion

These 3 ways to search the content of files in Windows have been tested working in 2023. File Explorer search is the most convenient way, but the slowest. Findster is much faster than File Explorer search but the learning curve can stop many users. All in all, Anytxt is best for search the content of files in terms of speed and ease of use.

How to Search a File by Content in Windows 11 ?

Simple as the title says… I thought I could use these commands because of what the find command says on its help but it is not working for me. Am I missing anything?

dir /s /f *.txt | find "READONLY"

With that I want to find every occurrence of the word «READONLY» in every .txt file.

Edit: While writing this question I looked for the suggestions and the findstr command showed up. But it is not finding anything at all.

asked Feb 13, 2013 at 11:54

sebagomez's user avatar

I’m not sure what you are trying to do.

The /F option is not valid for the DIR command. Correction — I’m told the /F option is a Windows 8 feature. Ignoring that problem, your command is attempting to look for the string READONLY in the output of the DIR command. That will never happen unless a folder or file name contains the text «READONLY» in the name.

If you want to list files that contain «READONLY» in the file content, then:

findstr /s /m READONLY *.txt

The above is case sensitive. If you want case insensitive, then add the /I option.

findstr /s /m /i READONLY *.txt

If you want to list files that have the READONLY attribute, (you cannot modify them), then

dir /s /ar *.txt

answered Feb 13, 2013 at 12:06

dbenham's user avatar

dbenhamdbenham

128k28 gold badges254 silver badges391 bronze badges

4

find every occurrence of the word «READONLY» in every .txt file [recursively starting from the current directory]

for /f "tokens=1 delims=" %f in ('dir/s/b *.txt') do findstr "READONLY" %f

Be sure to replace % with %% if you’re running within a script.

answered Feb 13, 2013 at 12:48

ty733420's user avatar

ty733420ty733420

8947 silver badges13 bronze badges

1

Try using

grep -R 'READONLY' *.txt

answered Feb 13, 2013 at 11:58

Ravi Maggon's user avatar

0

  1. Image titled Search for Text in Files on Windows Step 1

    1

    Press Win+S. This opens the Windows Search box.

  2. Image titled Search for Text in Files on Windows Step 2

    2

    Type indexing options. A list of matching results will appear.

    Advertisement

  3. Image titled Search for Text in Files on Windows Step 3

    3

    Click Indexing Options. It should be the first result in the list (and it may be the only result).

  4. Image titled Search for Text in Files on Windows Step 4

    4

    Click Advanced. It’s the button at the bottom of the window. Depending on your settings, you may also be asked to confirm the action or enter your administrator password.

  5. Image titled Search for Text in Files on Windows Step 5

    5

    Click the File Types tab. It’s near the top of the window. A list of file types on your computer will appear.

  6. Image titled Search for Text in Files on Windows Step 6

    6

    Select Index Properties and File Contents. It’s the second radio button beneath the list of file types.

  7. Image titled Search for Text in Files on Windows Step 7

    7

    Click OK. Windows will now begin to index the text within your documents instead of just their titles. Now that you’ve made this change, you can search for a file by typing some of the words it contains.

  8. Image titled Search for Text in Files on Windows Step 8

    8

    Press Win+S. This opens the search box. Now you’ll try searching for a file based on some of its text.

    • You can also search using the File Explorer (which you can launch by pressing Win+E). Just type your search criteria into the search bar at the top-right corner of the window.
  9. Image titled Search for Text in Files on Windows Step 9

    9

    Type your search criteria and press Enter. Windows will return a list of files that contain the text you entered.

    • This tool will only return exact matches. Make sure all spaces and symbols are in the correct places, and that you’ve made no spelling mistakes.
  10. Image titled Search for Text in Files on Windows Step 10

    10

    Double-click the file to open it. The file should open in its default application, such as Microsoft Word or Notepad.

    • See this method to learn how to search the currently-open document for a string of text.
  11. Advertisement

  1. Image titled Search for Text in Files on Windows Step 11

    1

    Open your document in its default application. This method should work for the majority of text/word processing applications, including Microsoft Word and Notepad.

  2. Image titled Search for Text in Files on Windows Step 12

    2

    Press Ctrl+F. This opens the Find or Find and Replace dialog.

  3. Image titled Search for Text in Files on Windows Step 13

    3

    Enter the text you want to find. Be specific—this tool will only return exact matches. Make sure all spaces and symbols are in the correct places, and that you’ve made no spelling mistakes.

  4. Image titled Search for Text in Files on Windows Step 14

    4

    Press Enter. The application should now display the text you searched for highlighted in a different color. If no matching text is found, you’ll see a message that says something like “The search item was not found.”

  5. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Thanks for submitting a tip for review!

About This Article

Thanks to all authors for creating a page that has been read 24,664 times.

Is this article up to date?

To get to the Indexing Options:

Start —> Control Panel —> Indexing Options

See Change advanced indexing options for more information.

If you click on the Advanced button in Indexing Options and go to the File Types tab, you will get a list of file types and the way they are indexed. For the file types you want, you can specify that you want the file contents indexed, and not just the file properties.

Or you can just do a normal search, and after the search is finished you can click on the «File Contents» button under the «Search again in» field (which is located after the end of the search results list, if you scroll to the bottom).

Based on this page, the «File Contents» option won’t always show up — only when the folder being searched is not marked for file content indexing; in that case, file contents are supposedly searched automatically, without having to specify this option explicitly.

In Windows 11, you can search for files that contain certain texts or contents using the default search in File Explorer or Start. However, if the files and folders are not indexed by Windows, the search may take a very long time to complete depending on the number of files it has to search.

To speed up the search, you can configure Windows 11 to index the files and folders for faster searches, or you can use a software instead to perform much more powerful searches and replaces.

This guide will show you how to use a powerful tool called grepWin to search for text and contents in files on Windows 11 with much faster search speed.

Search for Text or Contents in Files on Windows 11

GrepWin is a powerful tool that allows you to search for files containing certain text in any folder or directory on Windows 11. You can even search an entire drive for files that containing a certain text you want to search for.

It has all the tools you need to filter your search results such as file size filter, types of files, etc. It also supports regular expressions that some users may find useful when performing advanced searches.

GrepWin also allows you to do search and replace. You can search for certain texts in files and let grepWin to automatically replace them with other texts.

You can download grepWin from https://github.com/stefankueng/grepWin/releases/.

If this is your first time downloading an app or tool from GitHub, here’s what you should look for. On the download page, look for the post marked with “Latest“, which usually appear as the top most post. Then, click on an installer under Assets of that release. For example, if you are using 64-bit Windows 11, select grep-Win-x64.msi.

Optionally, you can also download the grepWin portable version if you don’t want to install the software. Portable means that you can use the software by directly running its executable file without the need to install the software first. However, installing grepWin can add a “search with grepWin” to the Windows context menu which allows you to quickly search with grepWin by just right-clicking a folder or a drive.

How to search for files containing text in Windows 11 using grepWin

After installing grepWin, to search for files containing certain text in a folder or drive, right-click on the folder or drive, select Show more options > Search with grepWin.

Search for files containing text in Windows 11

Alternatively (especially if you run grepWin portable version), you can directly run grepWin and manually enter the path to the folder you want to search in the “Search in” field.

To search for text in files in the selected folder, enter the text you want to search for in the “Search for” field. Then, click on the Search button. The search results will then return all the files that contain the string you’ve entered. Make sure the All sizes under Limit search is selected if you want to search all the files regardless of their file sizes.

How to search for text in files Windows 11

To search and replace using grepWin, in the grepWin window, enter a text you want to search for in the “Search for” field, and enter a text you want to replace with in the “Replace with” field. Then, click on Replace. GrepWin will then search the folder for matching texts and automatically replaces them whenever the stated text is found. It is recommended that you select the “Create backup files” before replacing to allow the tool to automatically create a backup whenever it has to replace texts on a file.

Search and replace text in files Windows 11

Tip: You can also use the advanced filters in the tool to further narrow down your search results. For example, you can limit your search by file size. Simply select “Size is” under Limit search, and select either “less than“, “equal to” or “greater than” option, and finally enter a file size you want to filter.

Search files by size date and type of files

There are other filters such as “search case-sensitive”, include or exclude system items, subfolders, hidden items or binary files, date created of files, file names match, and regular expressions.

  • Find process by pid windows
  • Final fantasy 15 windows edition читы
  • Find name driver error c windows system32 drivers delete or move desktop
  • Final cut pro скачать бесплатно для windows 10 крякнутый
  • Find my device скачать на компьютер для windows