我有一个 Powershell 脚本,用于监视日志文件,过滤出有趣的部分,并在它们被写入文件时呈现给我。非常有效。感兴趣的代码行如下:
```html
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 wonderfully. The line of interest is:
```get-content "$logFile" -wait | where { select-string $searchTerm -inp $_ }
现在我想让它更加花哨!
我希望在遇到特定词语时能够改变字体颜色。我可以轻松地设置字体颜色,但如何在上述语句中实时更改呢?
编辑:已经解决,但要等8小时后才能发布答案。明天会上传。
~~