search - recursive - select-string wildcard




PowerShell FINDSTR eqivalent? (2)

For example, find all instances of "#include" in the c files in this directory and all sub-directories.

gci -r -i *.c | select-string "#include"

gci is an alias for get-childitem

What's the DOS FINDSTR equivalent for PowerShell? I need to search a bunch of log files for "ERROR".


Here's the quick answer

Get-ChildItem -Recurse -Include *.log | select-string ERROR 

I found it here which has a great indepth answer!





powershell