/ Published in: Windows PowerShell

-force will include system/hidden files. %{$_.path } will print the filepath rather than the grep-like line containing searchText -List results in 1 hit per file rather than each line containing searchText.
Expand |
Embed | Plain Text
get-childitem "C:\Windows" -include "OEM*.inf","*.txt" -recurse -force | select-string "searchText" -List | %{$_\3.path }
You need to login to post a comment.