$searchDirectories='C:\users\Public\.jenkins\jobs'
$searchDepth=1
$fileNameScope='*.xml'
$searchString='kimconnect'
# Select the files and perform the search in each file
$files=Get-ChildItem -Path $searchDirectories -Depth $searchDepth -Filter $fileNameScope
$files|%{
$x=Select-String -Path $_ -Pattern $searchString;
if($x){
write-host "File $_ contains $searchString`r`n$x`r`n"
}
}
Categories: