Powershell 递归遍历目录下的文件内容
- 作者: 倾尽一世柔情丶
- 来源: 51数据库
- 2022-09-21
$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
}
}
}
推荐阅读
