How to Search File Contents
with PowerShell on Windows

October 5, 2026 · 7 min read

You need to find a specific piece of text buried somewhere in your files. Maybe an error message in a log file, a configuration value, or a name in a report. You know it is in there somewhere, but you have no idea which file contains it.

PowerShell can help, but it is not the only option. Here are three ways to search inside files on Windows, from the command line to a simpler alternative that does not require any commands at all.

Method 1: PowerShell Select-String (The Built-in Option)

PowerShell comes with every modern version of Windows, and its Select-String cmdlet is the most common way to search inside files from the command line. Think of it as the PowerShell version of grep.

Basic usage:

  1. Open the Start menu and type PowerShell
  2. Press Enter to open it
  3. Navigate to your folder with cd, or use a full path in the command
  4. Run this command:
Get-ChildItem -Recurse -Include *.txt,*.csv,*.log |
  Select-String -Pattern "search term"

This searches all .txt, .csv, and .log files in the current folder and all subfolders. For each match, PowerShell prints the filename, line number, and the matching line.

A few useful variations:

# Case-sensitive search
Get-ChildItem -Recurse -Include *.txt,*.log |
  Select-String -Pattern "Error" -CaseSensitive

# Search a specific folder
Get-ChildItem -Path "C:\Users\YourName\Documents" -Recurse -Include *.txt,*.csv,*.log |
  Select-String -Pattern "timeout"

# Show just the filenames that contain a match
Get-ChildItem -Recurse -Include *.txt,*.csv,*.log |
  Select-String -Pattern "search term" | Select-Object -Unique Path

# Search for an exact phrase (not regex)
Get-ChildItem -Recurse -Include *.log |
  Select-String -SimpleMatch -Pattern "connection refused"

Limitations:

Method 2: findstr (The Old-School Way)

If you prefer the traditional Command Prompt over PowerShell, or you are working on a system where PowerShell is restricted, findstr is the CMD alternative. It has been around since the early days of Windows and still works fine for basic text searches.

Basic usage:

  1. Open the Start menu and type cmd
  2. Press Enter to open Command Prompt
  3. Run this command:
findstr /s /i "search term" C:\Users\YourName\Documents\*.*

The most useful flags:

For example, to find all files containing "password" and show line numbers:

findstr /s /i /n "password" C:\Projects\*.config

Limitations:

Method 3: FileScope — Search Your Files Without Writing Commands

If PowerShell and findstr feel like too much work for what should be a simple task, you are not alone. Most people just want to type what they are looking for and get an answer.

FileScope lets you do exactly that. Instead of writing commands, you press Ctrl+Space, describe what you need, and get results from all your files instantly.

Steps:

  1. Download and install FileScope
  2. Choose the folders you want it to scan
  3. Press Ctrl+Space anywhere on your desktop
  4. Describe what you are looking for
  5. Open the matching file directly from the results

For example, instead of writing a PowerShell command to search log files for an error code, you can just type:

"connection timeout error from last week"

FileScope understands what you mean, even when the exact words don't appear together in the file. It searches the actual contents and uses a local AI model to understand your query.

More Than Text Files

FileScope is not limited to text files. You can also search across:

Everything runs locally on your Windows PC, so your files don't need to be uploaded to the cloud and you don't need a cloud account.

Why FileScope Is Useful

PowerShell is powerful, but it requires you to know the right commands and syntax. FileScope gives you the same result (find the file that contains what you need) without any of that. You search for what you remember, instead of having to remember where you saved it.

Comparison: Select-String vs findstr vs FileScope

Feature Select-String findstr FileScope
Search multiple files Yes Yes Yes
No commands needed No No Yes
Search by meaning No No Yes
Searches PDFs / Word / Excel No No Yes
Speed (repeat searches) Slow (re-reads all files) Slow (re-reads all files) Under 1 second
Regex support Yes Limited No (not needed)
Price Free (built-in) Free (built-in) $19 one-time

Find Any File. Just Describe It.

Find documents, images, and files by name, content, or meaning. Just describe what you're looking for.

Get FileScope — $19 Lifetime Access

Windows Search exists, but it is unreliable for content search. By default, it only indexes filenames and properties, not the text inside your files. You can change this in Indexing Options, but even then it only works within indexed folders and only matches exact keywords.

It cannot match the precision of PowerShell's Select-String for exact text searches, and it cannot match the ease of use of FileScope for natural language searches. For most people, Windows Search is fine for finding files by name, but not for finding files by what is inside them.

Conclusion

PowerShell's Select-String is the go-to tool for developers and IT professionals who need to search inside files from the command line. It is flexible, supports regex, and comes built into Windows. findstr works in a pinch but is more limited, especially when it comes to regex and output formatting.

If you want the same results without writing commands, FileScope handles it from a simple search bar. Press Ctrl+Space, describe what you need, and get your answer in under a second.

Find Any File. Just Describe It.

Find files by what you remember, not what you named them.

Get FileScope — $19 Lifetime Access

You know what's in the file.
Not what you named it.

Press Ctrl+Space and describe what you need. FileScope finds any file by name, content, or meaning.

Get FileScope — $19 Lifetime Access
Find Any File. Just Describe It. Get FileScope — $19 Lifetime Access