PowerShell Script for Find In Files

A co-worker gave me this Windows PowerShell script that I used to find files that contained a certain value…because the Windows Search Companion stinks!

gci -include *.txt *.* |? { $n = $_.FullName; $t = $false; gc $_ |% {$t = $t -or $_.Contains(“stringtofind”)}; if($t) {$n} }

Seems to do the trick!

Thanks Jason Turnage!!! 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s