如何用批处理ping网站,并生成文本文件保存?

来源:百度知道 编辑:UC知道 时间:2024/05/19 20:35:27
我想用批处理文件生成一个运行后就自动PING新浪等网站,然后把ping完的结果导出来生成一个文本文件(最好自动生成带当前日期和时间的文件名)。有人知道怎么写这个批处理文件吗?
我想把它做成批处理文件,不然每天一个一个输入,太费劲了!
还有,那个VB脚本运行之后没有结果出现,不知道是什么原因。

方法如下:
set w=wscript.createobject("wscript.shell")
Set Fsys=CreateObject("Scripting.FileSystemObject")
m_time=time
for i=1 to len(m_time)
str=mid(m_time,i,1)
if str=":" then
temp=temp+"-"
else temp=temp+str
end if
next
m_time=temp
w.run "ping www.123456.com >"&"d:\"&date&" "&m_time&".txt",1,true

把以上内容保存为ping.vbs后双击就可以了。(www.123456.com是你想PING的网址。)

set w=wscript.createobject("wscript.shell")
Set Fsys=CreateObject("Scripting.FileSystemObject")
m_time=time
for i=1 to len(m_time)
str=mid(m_time,i,1)
if str=":" then
temp=temp+"-"
else temp=temp+str
end if
next
m_time=temp
w.run "pi