Findstr.exe: What Is It & How to Properly Use It

Rediscover search with this powerful command-line tool

by Claire Moraa
Claire Moraa
Claire Moraa
Claire likes to think she's got a knack for solving problems and improving the quality of life for those around her. Driven by the forces of rationality, curiosity,... read more
Reviewed by Alex Serban
Alex Serban
Alex Serban
Windows Server & Networking Expert
After moving away from the corporate work-style, Alex has found rewards in a lifestyle of constant analysis, team coordination and pestering his colleagues. Holding an MCSA Windows Server... read more
Affiliate Disclosure
  • Finding files that have been renamed or moved from their original location can be difficult, especially if the file types are common and it's a lengthy search.
  • Findstr is a very powerful command line tool that makes it easy to search through files and folders based on criteria missing in the standard File Explorer search.
To fix various PC problems, we recommend Restoro PC Repair Tool: This software will repair common computer errors, protect you from file loss, malware, hardware failure and optimize your PC for maximum performance. Fix PC issues and remove viruses now in 3 easy steps:
  1. Download Restoro PC Repair Tool that comes with Patented Technologies (patent available here).
  2. Click Start Scan to find Windows issues that could be causing PC problems.
  3. Click Repair All to fix issues affecting your computer's security and performance
  • Restoro has been downloaded by 0 readers this month.

You already know how powerful the Windows Command Prompt is. You can even customize it. But did you know about its built-in command utility findstr.exe or Find String? Findstr.exe is a command-line utility that can search for strings in files. 

It is used to find a specific string in one or more files. By default, it searches the current directory and all subdirectories. While it can be helpful, it will do you no good if you don’t know how to use it. Lucky for you, we share how to get the most out of it here.

What is the usage of findstr.exe in Windows?

You may be wondering why anyone would use a command-line utility when Windows already has the find feature in File Explorer. While it works most of the time, it can be time-consuming and still not generate the expected results.

The main advantage of using findstr.exe over other text search tools is that it allows you to search inside binary files such as Microsoft Office documents or PDFs. 

In addition, findstr.exe provides options to control what kind of output is displayed and which lines are skipped when searching through large files with thousands of lines.

Other benefits of using findstr.exe include:

  • Supports regular expressions (regex) – Regular expressions allow complex searches that would be much more difficult using other methods such as wildcards or string comparisons. If you were wondering whether you can use regex in cmd, here’s your answer.
  • Searches binary files – While other search tools only work on text files. Findstr can search both text and binary files. 
  • Readily available – Findstr is not limited to a select Windows version. You can readily find it in older and newer versions of Windows. It also helps that you do not need to download it as it is built-in.
  • Allows case-insensitive searches – You don’t have to worry about capitalization when searching for words. This is one of the most common reasons some searches fail because they’re case-sensitive.

How to use Findstr in a batch file?

To use Findstr, you must run the Command Prompt with administrative privileges. This way, you can access all the drives on your computer and their folders, and your search won’t be limited. 

Expert tip:


Some PC issues are hard to tackle, especially when it comes to missing or corrupted system files and repositories of your Windows.
Be sure to use a dedicated tool, such as Fortect, which will scan and replace your broken files with their fresh versions from its repository.

This allows you to run commands that search through every folder on your hard drive. Before you embark on your search, you must know how the findstr commands work and when to use them.

Below are some of the common parameters:

  • /B – Matches pattern if at the beginning of a line.
  • /C – Search for strings containing the specified substring.
  • /S – Searches in the current directory and all subdirectories.
  • /I – Ignores uppercase and lowercase distinctions when searching for patterns. Also known as the Case-sensitive search.
  • /L – Lists only file names, not contents.
  • /R – Use regular expressions in strings.
  • /M – Print only matched file names.

To test a few examples:

1. Use case-insensitive parameters

  1. Hit the Windows key, type cmd in the search bar, and click Run as administrator.cmd-run-admin-w11 unexpected kernel mode trap windows 11
  2. We’re going to test out the case-insensitive string. Type the following command and hit Enter: findstr /s /i nba “.”
  3. In context, the term nba in the text is in caps, but with the /I command, it will search irrespective of the case, meaning that upper and lowercase characters are considered equal. The /s command will search in folders and sub folders while the “.” command specifies that the string should search each file and not limit to only text files.

2. Search for specific text

  1. Still in the Command Prompt window, type in the following command and hit Enter: findstr /c:"nba" kwame.txt
  2. In the command above, you have now refined your search only to locate the term nba and in the specific document named kwame.

3. Search files in a specific location

  1. Still in the Command Prompt window, type in the following command and hit Enter: findstr /c:"nba" y.z
  2. Here, you are searching for NBA in a specific location which is y and z in this case.

From the examples above, it is easy to see that Findstr.exe is a great resource when you want to search on your computer that you’ve never done before. It’s extremely useful but requires a specific syntax to know how to use it properly.

Hopefully, this little introduction to findstr.exe brings you a step closer to using it as part of your regular toolkit and taking advantage of all it offers.

Speaking of command-line utilities, we also have an awesome beginner guide on all things try-catch command, so be sure to check that out too.

Let us know how you will use this command-line in the comment section below.

Still experiencing issues?


If the above suggestions have not solved your problem, your computer may experience more severe Windows troubles. We suggest choosing an all-in-one solution like Fortect to fix problems efficiently. After installation, just click the View&Fix button and then press Start Repair.

This article covers:Topics: