芯路恒电子技术论坛

 找回密码
 立即注册
热搜: 合集
查看: 1094|回复: 0

使用power shell搜索文件内容

[复制链接]
  • TA的每日心情
    慵懒
    2021-2-24 10:16
  • 425

    主题

    785

    帖子

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    15867
    QQ
    发表于 2023-4-20 11:47:06 | 显示全部楼层 |阅读模式


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

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

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


    复制代码




    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|小黑屋|Archiver|芯路恒电子技术论坛 |鄂ICP备2021003648号

    GMT+8, 2024-5-1 00:36 , Processed in 0.162767 second(s), 32 queries .

    Powered by Discuz! X3.4

    © 2001-2017 Comsenz Inc. Template By 【未来科技】【 www.wekei.cn 】

    快速回复 返回顶部 返回列表