window cmd/PowerShell 实时查看监控日志命令Get-Content,类似与linux shell的tail命令

阅读 9

2024-05-10


命令

最近10行,使用UTF8字符编码

Get-Content app.log -Wait -Tail 10 -Encoding UTF8

查找“关键字”,忽略大小写,显示关键字的上下1行

Get-Content app.log -Wait -Tail 10 -Encoding UTF8 | Select-String "keyword" -CaseSensitive -Context 1, 1

  • 编写的bat脚本,需加上PowerShell

PowerShell Get-Content app.log -Wait -Tail 10 -Encoding UTF8 | Select-String "keyword" -CaseSensitive -Context 1, 1

参考文章

  • windows使用自带的PowerShell命令工具查看实时日志


精彩评论(0)

0 0 举报