Powershell 递归遍历目录下的文件内容

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

$fileList = Get-ChildItem  'D:\Services\' -recurse *.config | %{$_.FullName}
Foreach($file in $fileList)
{

   $tmpContent = Get-Content $file

   for ($i=0; $i -le $tmpContent.length; $i++)
   {
      if($tmpContent[$i] -like '*Over*')  # *Over* 要查找的内容
      {
         write-host $file
         write-host $tmpContent[$i] -background red
      }
   }
}