下面程序是以前写的,好像无法实现批处理,以前以为是因为时间延迟的问题,但在中间加了一个FOR语句,也没解决,如果那位仁兄,能搞定的话,那请告之小弟一声~~~TKS
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'批量检查指定服务器是否正常(除过滤icmp包的服务器)
'哈哈朱版权所有
'QQ:383088680
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error Resume Next
Dim FSO
Dim FilePath
Dim objPing
Dim objFile
Dim AllCont
Dim ColCont
Dim i
Dim ShowCont
ShowCont="哈哈朱温馨提醒:"+vbcrlf+vbTab+"请写出绝对路径(保证存在),而且是文本文件(如 c:\ip.txt),"+vbCRLF+"否则将不给予任何信息显示!"
Wscript.Echo ShowCont
FilePath=InputBox("请输入您要读取的文本文件内容的绝对路径!")'注意我们只接收文本文件,既.txt结尾
If Trim(FilePath)<>"" then
Set Fso=CreateObject("Scripting.FileSystemObject")
Set objFile=Fso.openTextFile(FilePath,1,True)
if Fso.GetExtensionName(FilePath)<>"txt" then
wscript.quit()
end if
AllCont=objFile.ReadAll
ColCont=Split(Trim(AllCont),",")
For i=0 to ubound(ColCont)
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select * from Win32_PingStatus where address = '"_
&ColCont(i)& "'")
For Each objStatus in objPing
If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
WScript.Echo("温馨提示: " & ColCont(i) & " 不能PING通啊!")
End If
Next
Next
wscript.quit()
Else
Wscript.Echo "你放弃了批量处理PING功能啊!"
Wscript.Quit()
End if