答案 0 :(得分:0)
您只需使用if语句或try catch语句并输入所需的消息。
($UrlOrIPA = 'stackoverflow.com')
($UrlOrIPA = '10.0.119.61:8101')
try
{
curl -Uri $UrlOrIPA -UseBasicParsing | Select Status*
"Testing $UrlOrIPA"
'Success'
}
catch
{
"Testing $UrlOrIPA"
'Failure'
}
StatusCode StatusDescription
---------- -----------------
200 OK
Testing stackoverflow.com
Success
Testing 10.0.119.61:8101
Failure