0
点赞
收藏
分享

微信扫一扫

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


命令

最近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 条评论