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.
- Press
Windows + Eto open File Explorer. - Open the folder containing the files you want to search.
- Click the search box or press
Ctrl + E. - Enter
content:"OutOfMemoryException"and pressEnter.
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:
- Select the three-dot menu in File Explorer.
- Select Options.
- Open the Search tab.
- Select Always search file names and contents.
- Select Apply.
- 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.
- Right-click Start.
- Select Terminal.
- Open a PowerShell tab.
- Run this command to search every
.logfile inC:\Logs:
Select-String -Path "C:\Logs\*.log" -Pattern "OutOfMemoryException"
You should see one output row for each matching line.
To include subfolders, use Get-ChildItem:
- Run this recursive command:
Get-ChildItem -Path "C:\Logs" -Recurse -File |
Select-String -Pattern "OutOfMemoryException"
To restrict the search to .log and .txt files:
- 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.
- Right-click Start.
- Select Terminal.
- Open a Command Prompt tab.
- Change to the folder you want to search:
cd /d C:\Logs
- Search every
.logfile in that folder and its subfolders:
findstr /s /n /i /c:"OutOfMemoryException" *.log
The switches control the output:
/ssearches subfolders./ndisplays line numbers./iignores 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.
- Install dnGrep from its official website.
- Open dnGrep.
- Select the root folder you want to search.
- Enter your word, phrase, or regular expression.
- Add a file filter such as
.txt;.log;*.cs. - Start the search.
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.
- AstroGrep displays the matching portion of each file and can save or print results.
- BareGrep provides a compact interface with regular-expression support and tabular results.
- PowerGREP targets heavier search-and-replace work across logs, documents, spreadsheets, and source files.
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:
- Open the folder containing your project.
- Press
Ctrl + Shift + F. - Enter the text you want to find.
- Enter a filter such as
.csor.jsin Files to include. - Select the regular-expression button if your search uses a pattern.
- Press
Enter.
Matches should appear grouped by file. Select a result to open the exact line.
For Notepad++:
- Press
Ctrl + F. - Open the Find in Files tab.
- Enter the search text.
- Enter a filter such as
*.txtin Filters. - Select the folder in Directory.
- Enable In all sub-folders when needed.
- 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.
- Install ripgrep using its official release package or your preferred Windows package manager.
- Open Terminal.
- Change to the folder you want to search.
- Run a basic recursive search:
rg "OutOfMemoryException"
Every matching path, line number, and line should appear in the terminal.
To search only .log files:
- Run this filtered search:
rg -g "*.log" "critical error" "C:\Logs"
To ignore letter case:
- Add the
-ioption:
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.
- Press
Windows + Ito open Settings. - Open Privacy & security > Searching Windows in Windows 11.
- Open Search > Searching Windows in Windows 10.
- Select Enhanced under Find my files if you want Windows to index your user folders.
- Open Advanced indexing options.
- Select Advanced.
- Open the File Types tab.
- Select the extension you need, such as
txt,log,docx, orpdf. - Select Index Properties and File Contents.
- Select OK.
Windows should begin updating the index. Search results may remain incomplete until that process finishes.
If an important folder isn’t indexed:
- Return to Indexing Options.
- Select Modify.
- Select the folder you want Windows to index.
- Select OK.
Rebuilding the index can fix an incomplete or damaged database:
- Open Advanced in Indexing Options.
- Select Rebuild under Troubleshooting.
- 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.
- Open the document in an app that supports optical character recognition.
- Run its OCR or text-recognition command.
- Save a searchable copy of the document.
- 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.