Tag: Search word in files

How to search a word in all files in a Folder – Powershell Script

To search a word in all files in a Folder using Powershell Script


$i=0
foreach ($filename in Get-ChildItem -Path FOLDERNAME\ -recurse | Select-String -pattern "SEARCHSTRING" | Select-Object -Unique path) 
{
split-path $filename.path -leaf -resolve
$i++
}
Write-host 'Total Files='$i