How to Search Inside Multiple Text Files at Once in Windows 11 and 10

·
7 min read

Help Desk Geek is reader-supported. We may earn a commission when you buy through links on our site. Learn more.

You need to search inside multiple text files at once, but opening every log, configuration, or code file by hand gets old fast. File Explorer‘s content: filter is worth a look first; PowerShell and dedicated search tools handle larger folders better.

Fix #1: Search file contents with File Explorer

File Explorer can find text inside supported files without installing another app. It works best in indexed folders, but you can force content searches elsewhere.

  1. Press Windows + E to open File Explorer.
  2. Open the folder containing the files you want to search.
  3. Click the search box or press Ctrl + E.
  4. Enter content:"OutOfMemoryException" and press Enter.
Windows 11 File Explorer showing a folder search for content:"OutOfMemoryException" with matching files listed

File Explorer should return files containing that exact phrase. Add an extension filter when you only want a specific file type:

content:"critical error" ext:.log

If no matches appear in a folder that contains the text, enable searches outside indexed locations:

  1. Select the three-dot menu in File Explorer.
  2. Select Options.
  3. Open the Search tab.
  4. Select Always search file names and contents.
  5. Select Apply.
  6. Run the search again.

Searching an external SSD, USB flash drive, or network storage drive can take longer because Windows may inspect each file directly.

File Explorer doesn’t support full regular expressions. It also needs a compatible search filter, called an iFilter, to read formats such as PDF and DOCX.

Fix #2: Search recursively with PowerShell

PowerShell’s Select-String command searches text without depending on the Windows index. It also reports each file path, line number, and matching line.

  1. Right-click Start.
  2. Select Terminal.
  3. Open a PowerShell tab.
  4. Run this command to search every .log file in C:\Logs:
Select-String -Path "C:\Logs\*.log" -Pattern "OutOfMemoryException"
PowerShell Select-String results showing file paths, line numbers, and lines containing OutOfMemoryException

You should see one output row for each matching line.

To include subfolders, use Get-ChildItem:

  1. Run this recursive command:
Get-ChildItem -Path "C:\Logs" -Recurse -File |
  Select-String -Pattern "OutOfMemoryException"

To restrict the search to .log and .txt files:

  1. Run this filtered command:
Get-ChildItem -Path "C:\Logs\*" -Recurse -File -Include *.log,*.txt |
  Select-String -Pattern "critical error"

Select-String treats patterns as regular expressions by default. Add -SimpleMatch when punctuation in the search text should be interpreted literally:

Get-ChildItem -Path "C:\Logs" -Recurse -File |
  Select-String -SimpleMatch -Pattern "[ERROR] Connection failed"

Microsoft’s Select-String reference lists its case-sensitive, context, and pattern options. The commands work in Windows PowerShell 5.1 and PowerShell 7.x.

Fix #3: Run a quick search with findstr

The built-in findstr command is handy in batch files or Command Prompt. PowerShell handles modern text encodings better, but findstr is faster to type for a simple check.

  1. Right-click Start.
  2. Select Terminal.
  3. Open a Command Prompt tab.
  4. Change to the folder you want to search:
cd /d C:\Logs
  1. Search every .log file in that folder and its subfolders:
findstr /s /n /i /c:"OutOfMemoryException" *.log
Command Prompt showing findstr recursive search results with file paths and line numbers

The switches control the output:

  • /s searches subfolders.
  • /n displays line numbers.
  • /i ignores letter case.
  • /c: treats the quoted phrase as one search string.

You should see the path, line number, and matching text for each result. Run findstr /? or check the findstr reference for more switches.

I’d skip findstr when files use mixed encodings or contain complex patterns. Select-String and ripgrep cope with those jobs better.

Fix #4: Search with a dedicated Windows app

A graphical search utility makes filters and regular expressions easier to manage. dnGrep is the strongest free option here: it searches multiple files, supports regular expressions, and displays matching text in a result pane.

  1. Install dnGrep from its official website.
  2. Open dnGrep.
  3. Select the root folder you want to search.
  4. Enter your word, phrase, or regular expression.
  5. Add a file filter such as .txt;.log;*.cs.
  6. Start the search.
dnGrep with a root folder, search text, file filters, and matching lines visible in the results pane

The matching files should appear with previews below the search controls. Double-click a result to open the file. For large log folders, it actually works smoothly, and the preview is nicely done.

Several established alternatives cover similar jobs:

  • grepWin supports regular-expression searches, text replacement, filters, and an Explorer context-menu command.
Current grepWin interface showing a folder path, regular-expression search field, file filters, and matching results
  • AstroGrep displays the matching portion of each file and can save or print results.
Current AstroGrep interface showing search text, file filters, result files, and matching lines
  • BareGrep provides a compact interface with regular-expression support and tabular results.
Current BareGrep interface showing a text pattern, folder selection, and tabular search results
  • PowerGREP targets heavier search-and-replace work across logs, documents, spreadsheets, and source files.
Current PowerGREP interface showing file selection, search action settings, and matching results

For ordinary logs and source files, start with dnGrep or grepWin. PowerGREP makes more sense when advanced replacement and document-format support are part of the job.

Fix #5: Use Find in Files in your code editor

An editor is often the quickest option when the files already belong to a project. Visual Studio Code and Notepad++ both support folder searches, file filters, case matching, and regular expressions.

For Visual Studio Code:

  1. Open the folder containing your project.
  2. Press Ctrl + Shift + F.
  3. Enter the text you want to find.
  4. Enter a filter such as .cs or .js in Files to include.
  5. Select the regular-expression button if your search uses a pattern.
  6. Press Enter.
Visual Studio Code Search panel showing a project-wide text search, Files to include filter, and grouped matching lines

Matches should appear grouped by file. Select a result to open the exact line.

For Notepad++:

  1. Press Ctrl + F.
  2. Open the Find in Files tab.
  3. Enter the search text.
  4. Enter a filter such as *.txt in Filters.
  5. Select the folder in Directory.
  6. Enable In all sub-folders when needed.
  7. Select Find All.

The Find result panel should list every matching file and line. This is a clever option for folders you don’t want to turn into a full editor workspace.

Fix #6: Search large folders with ripgrep

Ripgrep, whose command is rg, is built for fast searches through source trees and large text collections. It skips binary files and respects .gitignore rules by default.

  1. Install ripgrep using its official release package or your preferred Windows package manager.
  2. Open Terminal.
  3. Change to the folder you want to search.
  4. Run a basic recursive search:
rg "OutOfMemoryException"

Every matching path, line number, and line should appear in the terminal.

To search only .log files:

  1. Run this filtered search:
rg -g "*.log" "critical error" "C:\Logs"

To ignore letter case:

  1. Add the -i option:
rg -i "connection failed" "C:\Logs"

Ripgrep is my pick for large code repositories. Its defaults cut out much of the noise generated by build folders and ignored files.

Fix #7: Configure the Windows search index

Tune the index when File Explorer consistently misses content from supported files. Windows can index entire file contents for selected extensions.

  1. Press Windows + I to open Settings.
  2. Open Privacy & security > Searching Windows in Windows 11.
  3. Open Search > Searching Windows in Windows 10.
  4. Select Enhanced under Find my files if you want Windows to index your user folders.
  5. Open Advanced indexing options.
  6. Select Advanced.
  7. Open the File Types tab.
  8. Select the extension you need, such as txt, log, docx, or pdf.
  9. Select Index Properties and File Contents.
  10. Select OK.
Indexing Options Advanced dialog on the File Types tab with txt selected and Index Properties and File Contents enabled

Windows should begin updating the index. Search results may remain incomplete until that process finishes.

If an important folder isn’t indexed:

  1. Return to Indexing Options.
  2. Select Modify.
  3. Select the folder you want Windows to index.
  4. Select OK.

Rebuilding the index can fix an incomplete or damaged database:

  1. Open Advanced in Indexing Options.
  2. Select Rebuild under Troubleshooting.
  3. Confirm the rebuild.

Index rebuilding can take a while on large drives. Keep using PowerShell or dnGrep while it runs.

Fix #8: Convert files Windows can’t read

Content searches won’t find words inside scanned PDFs because those pages contain images rather than searchable text. Encrypted documents and unsupported proprietary formats can cause the same problem.

  1. Open the document in an app that supports optical character recognition.
  2. Run its OCR or text-recognition command.
  3. Save a searchable copy of the document.
  4. Search the new file with File Explorer or a document search tool.

You should be able to select individual words in the converted PDF. If you can’t select text, OCR hasn’t produced a searchable text layer.

When searches still miss files

Open one of the missed files and confirm that its text is readable. A damaged file, unsupported encoding, access restriction, or disconnected network share can block every search method. If the files open correctly, use PowerShell with -SimpleMatch or dnGrep before changing more Windows settings.

Conclusion

Fix #2, PowerShell’s Select-String, is my usual pick because it returns paths, line numbers, and matching text without relying on the Windows index. For repeated searches, dnGrep is a gem I recommend keeping installed; if files also fail to open or copy, check the drive for corruption or hardware failure.