How Do You Find Files with a Specific Pattern of Text?

Problem scenario
You want to do a regex with PowerShell. Using PowerShell, how do you retreive all .txt files that have the sequence of characters "foobar" in them?

Solution
Run a command like this:

Select-String -Path c:*.txt -pattern foobar

This solution was adapted from this external website.

Leave a comment

Your email address will not be published. Required fields are marked *