powershell - Powershell中的Truncat日志消息
问题描述
我尝试使用 Powershell 截断 wifi 日志的第一行,但我不知道它为什么不起作用。谁能建议以下代码有什么问题?
(Get-WinEvent -Logname Microsoft-Windows-WLAN-AutoConfig/Operational | select -first 1).Message.split('`n')[0]
解决方案
尝试:
(Get-WinEvent -Logname Microsoft-Windows-WLAN-AutoConfig/Operational | select -first 1).Message.split("`n")[0]
单引号字符串被视为文字,我认为您是在拆分字母 'n' :)
推荐阅读
- sql - 交易日期 <= @Date 参数的表上的每日增量结果
- python - 没有得到二进制列熊猫的统计分析
- c - 对于 C 的基于概率的随机数生成器,这是一个很好的设置吗?
- php - 以 15 分钟为增量获取两个日期之间的碳差
- javascript - .map 函数中的异步验证
- postgresql - Helm Chart 可用于 Openshift 上的高可用性 PostgreSQL
- node.js - 使用聚合对 MongoDB 列求和 - 结果没有求和的属性
- android - 确保 30 分钟后不缓存前台服务
- linux - Yocto bitbake 包组
- sql - De Morgan 定律如何在条件 SQL 查询中起作用?