# D:\Services\ 指定要递归遍历查找的目录

# *.config 找查找的文件名

$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
      }
   }
}

相关文章:

  • 2022-03-08
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
  • 2022-02-17
  • 2022-12-23
相关资源
相似解决方案