(1) 首先打开记事本
编写如下
del d:\1.txt
ping 192.168.100.3 -n 5 >>d:\1.txt
ping 202.101.172.35 -n 5 >>d:\1.txt
ping 8.8.8.8 -n 5 >>d:\1.txt
ping baidu.com -n 5 >>d:\1.txt
ping 163.com -n 5 >>d:\1.txt
保存为superping.bat
(2)编写VBS脚本
打开记事本
f="zjsyswf@126.com"
t="zjsyswf@126.com"
pass="xxxxxxx"
zt="ping状况测试"
nr=""
fj="D:\1.txt"
zh=split(f,"@")
set fso=createobject("scripting.filesystemobject")
if fso.fileexists(fj) then
set fil=fso.getfile(fj)
filename=fil.name
if lcase(right(filename,4))=".txt" then
set txt=fso.opentextfile(fj,1)
code=txt.readall
txt.close
end if
end if
nr=nr&chr(13)&code
NameSpace = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
Email.From =f
Email.To =t
Email.Subject =zt
Email.textbody=nr
With Email.Configuration.Fields
.Item(NameSpace&"sendusing") = 2
.Item(NameSpace&"smtpserver") = "smtp."&zh(1)
.Item(NameSpace&"smtpserverport") = 25
.Item(NameSpace&"smtpauthenticate") = 1
.Item(NameSpace&"sendusername") = zh(0)
.Item(NameSpace&"sendpassword") = pass
.update
End With
Email.Send
保存文件名为 发邮件.vbs
将这两文件都放在D盘根目录下
(3)创建计划任务
然后创建计划
完成后的效果图
转载于:https://blog.51cto.com/568a568b/628564