Search For Text in Files using Powershell

Using Microsoft Powershell, you can quickly search for text in files:

Get-ChildItem –recurse | where {$_.extension –eq “.cs”} | foreach ($_) {Select-String StringToSearchFor $_}

Theexample above recurses through all folders below the current one, checking to see if the extension is *.cs (C# Code Files), and looking for the text "StringToSearchFor". 

Posted on 9/11/2010 9:50:00 AM by Jason Nadal

Permalink | Comments |

Categories: powershell

Tags:

Currently rated 3.2 by 11 people

  • Currently 3.181818/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5