Powershell – Recursive Search for Strings in Files
To search for a string (grep) in files recursively with Powershell (example): gci -recurse -include *.sql|%{gc $_} | %{$_|select-string “dba”} To get the filename(s): gci -recurse -include *.txt|%{$Filename=$_;gc $_} | %{$res=$_|select-string “dba”;if ($res) {Write-Host “$Filename”}}