从文件中找出关键字
$colItems = Get-ChildItem d:\test #定义文件夹的路径 foreach ($i in $colItems) #循环获取文件夹下的txt文件 { $filecontent= Get-Content $i.fullName | findstr /i "a" #获取txt文件的内容 并找到数字a write-host $filecontent $i.fullname} #输出到屏幕上
Powershell 从多个文件中找出关键子文件(findstr)
原文:http://www.cnblogs.com/thescentedpath/p/findstr.html