Monday, March 08, 2010

Using the Windows Findstr Command to Find Text, Files and Folders

Currently, I like the findstr command better than other ways to search files in Windows.

Prerequisite: Open Command Window Here
For XP, it's part of Microsoft PowerToys for Windows XP.

For Vista and Windows 7, apparently you hold down the hold down the shift key and right click.

Finding File Contents
Once you have a command window open at the directory you want to search within, you  can do something like this, which will return all lines containing "MyText" in all subdirectories of the current one, case-insensitive, and only searching files that contain printable characters:

findstr /s /i /p "MyText" *.*

It turns out that "MyText" is treated as a regular expression, which is great. But if you don't want it treated as a regular expression, you can use the /l or /c: options.

Finding File & Folder Names
Instead of giving findstr files to search, you can pipe text to it from another command, so to search for file or folder names, you can give it the results of the dir command to search:

dir /s /b | findstr /i "MyFileName.txt"

Combining the Two
Say you want to find all the lines containing "MyText", except you don't want those that are part of a subversion directory. You can do this, where the /v option means only return lines that don't match:

findstr /s /i /p "MyText" *.* | findstr /v /l ".svn"


  1. Hello,

    This was a post that really came in handy. I was having problems with a link in my blog footer and I could not find out which page the code was located on. After opening DOS and following your instructions, the most annoying problem was solved!

    1. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important. Project Center in Chennai It’s what organizations do with the data that matters. Big data can be analyzed for insights that lead to better decisions and strategic business moves.

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the authors explore the idea of using Java in Big Data platforms.

      Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

  2. Great post. I was having a hard time getting this to work on my own with the lackluster instructions available on other sites. Thank you!

  3. There has been possible instances and the values for the students mentioned in detail and these are almost allowing them to proceed further.

  4. Getting problem to update the latest version- Windows 10 had got significant update in November itself but many could not update it.

  5. Due to which users were unable to understand the windows 10 upgraded problems in the first place and think how to solve them? kmspico

  6. I read a article under the same title some time ago, but this articles quality is much, much better. How you do this.. Search Bar Firefox 57 Quantum addon

  7. I was looking for some solution on google and then I cam across your website and got addicted. Such a nice way of website management, colours, way of writing and layout is attractive.
    ipl live score
    free ipl score
    ipl final live streaming
    ipl final 2018
    ipl live streaming
    ipl final score
    ipl live stream 2018
    ipl live score 2018
    ipl Schedule 2018
    watch ipl online live

  8. Watch IPL 2018 here. Check IPL live Score at Watch IPL live? IPL
    Live stream
    available here for free. Watch IPL Final or check ipl live score 2018 or IPL Final Live Stream.

  9. Good one.You shared a valuable information

  10. Your post is very helpful to get some effective tips to reduce weight properly. You have shared various nice photos of the same. I would like to thank you for sharing these tips. Surely I will try this at home. Keep updating more simple tips like this.  Check plagiarism

  11. Windows 10 is the up and coming version of Windows that will be released to the world in the near future. We need Secure Password Generator for saving our personal data or computer security. In this article we are going to take a look at the different versions of window 10 and get strong passwords for accounts.

  12. One of those unfortunate things to forget is your Windows log in password. etcher alternative


  13. تعد الاول افضل شركة غسيل خزانات بالمدينة المنورة تعمل على استخدام افضل ادوات تنظيف وتعقيم خزانات المياه