Colour-coding get-content results

后端 未结 2 1998
时光说笑
时光说笑 2020-12-15 11:34

I\'ve got a powershell script that monitors a log file, filters out the interesting bits and then presents those bits to me as and when they are written to the file. Works w

2条回答
  •  死守一世寂寞
    2020-12-15 12:15

    Try

    Get-Content $logFile -Wait |
      Select-String $searchTerm | 
      ForEach {write-host -ForegroundColor red $_.line}
    

提交回复
热议问题