命令
最近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命令工具查看实时日志