小编Car*_*ten的帖子

从输出中删除空行

我有这个脚本:

for ( ; $true ; )
{
    Write-Host ""
    Get-Date -UFormat "%Y-%m-%d %H:%M:%S"
    ping -n 1 10.10.50.203 | Select-String -SimpleMatch "Pinging" -Context 1,2
    ping -n 1 10.10.50.201 | Select-String -SimpleMatch "Pinging" -Context 1,2
    timeout 5 > null
}
Run Code Online (Sandbox Code Playgroud)

它产生这个输出:

2018-08-29 14:40:49


> Pinging 10.10.50.203 with 32 bytes of data:
  Request timed out.


> Pinging 10.10.50.201 with 32 bytes of data:
  Reply from 10.10.50.201: bytes=32 time=58ms TTL=126

2018-08-29 14:40:54

> Pinging 10.10.50.203 with 32 bytes of data:
  Request timed out. …
Run Code Online (Sandbox Code Playgroud)

powershell output

4
推荐指数
1
解决办法
1037
查看次数

标签 统计

output ×1

powershell ×1