admin 发表于 2023-4-20 11:47:06

使用power shell搜索文件内容



$path = 'G:\Dev_Temp\FPGA\AC590\AC590_SoC_GHRD\software\spl_bsp'
$searchword = 'CONFIG_EMAC0_BASE'
$Filename = '*.h'

$filesWithKeyword = Get-ChildItem $path -Include "$Filename" -Recurse |Where-Object { $_ |Select-String -Pattern $searchword -SimpleMatch |Select-Object -First 1 }

Write-Host "Contents of ArrayPath:"
$filesWithKeyword.FullName






页: [1]
查看完整版本: 使用power shell搜索文件内容