回答Powershell的退出码


$?

PS> ping dfadsfdfdsfdsf.eee.com
Ping request could not find host dfadsfdfdsfdsf.eee.com. Please check the name and try aga
PS> $?
False
PS> ping baidu.com

Pinging baidu.com [123.125.114.144] with 32 bytes of data:
Reply from 123.125.114.144: bytes=32 time=185ms TTL=41
Reply from 123.125.114.144: bytes=32 time=185ms TTL=41
Reply from 123.125.114.144: bytes=32 time=185ms TTL=41
Reply from 123.125.114.144: bytes=32 time=184ms TTL=41

Ping statistics for 123.125.114.144:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 184ms, Maximum = 185ms, Average = 184ms
PS> $?
PS> True

 

×用微信扫描并分享

关于 Mooser Lee

我是一个Powershell的爱好者,创建了PowerShell中文博客,热衷于Powershell技术的搜集和分享。本站部分内容来源于互联网,不足之处敬请谅解,并欢迎您批评指正。