This shows you how you can search in files for a specific content with Windows Powershell. This “replaces” the Windows command-line utility “findstr”. In the Unix/Linux world you mostly use the command grep for doing the same.
grep (options) files.txt
grep "text I search" *.log
In Windows Powershell we can use the Select-String to search strings in files
Select-String -Path C:\temp\*.log -Pattern "Contoso"
If you need some more options, for example you need also check subfolders (-Recurse) or you need additional filter for files you wanna check, you can use the Get-Childitem first.
Get-ChildItem C:\temp -Filter *.log -Recurse | Select-String "Contoso"
If you have to copy all the files with a specific content, you can simply add a Copy-Item cmdlet.
Get-ChildItem C:\temp -Filter *.log -Recurse | Select-String "Contoso" | Copy-Item -Destination C:\temp2
More Information about Select-String: