⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pingit.vbs

📁 Apress - Managing Enterprise Systems With The Windows Script Host Source Code
💻 VBS
字号:
'pingit.vbs
Dim strLine, nCount, objTextStream, strComp, bBad
nCount = 0
'loop until the end of the text stream has been encountered
Do While Not WScript.StdIn.AtEndOfStream
  strLine = Wscript.StdIn.ReadLine
  'check if bad IP address encountered
  If Left(strLine, 14) = "Bad IP address" Then
    bBad = True
    Exit Do
  End If

  If Left(strLine, 10) = "Reply from" Then
    nCount = nCount + 1
  End If
  If Left(strLine, 7) = "Pinging" Then
    strComp = Mid(strLine, 9, Instr(strLine, "]") - 8)
  End If
Loop

'check if bad IP address encountered
If bBad Then 
  WScript.Echo "Bad IP address:" & Mid(strLine,15)
Else
  Wscript.Echo nCount & " replies received from " & strComp
End If

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -