jeffharbert

Find files with Powershell

Apr 27th, 2016
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## This will recursively search all txt files for the phrase 'windows 10' and return the path, line number, and line.
  2. ## You can of course change the file extension, leave out the -recurse switch to not search recursively,
  3. ## and change the search phrase, and leave out one or more of the Select options. Leaving off Format-List
  4. ## returns uglier results.
  5.  
  6. get-childitem . -include *.txt -recurse | Select-String "windows 10" | Select Path, LineNumber, Line | Format-List
Advertisement
Add Comment
Please, Sign In to add comment