- On Error Resume Next
- Dim f,d
- Set f=CreateObject("Scripting.FileSystemObject").GetFile("C:\test.log")
- Do
- WScript.Sleep 600000
- d=DateDiff("n",f.DateLastModified,Now())
- If d>14 then
- CreateObject("WScript.Shell").Run "C:\test.exe"
- Send_mail
- End If
- Loop
- Sub Send_mail()
- MS_Space = "http://schemas.microsoft.com/cdo/configuration/"
- Set Email = CreateObject("CDO.Message")
- Email.From = "yonghuming@sina.com"
- Email.To = "batcher@bbs.bathome.net"
- Email.Subject = "报警"
- Email.Textbody = "报警啦报警啦!"
- With Email.Configuration.Fields
- .Item(MS_Space&"sendusing") = 2
- .Item(MS_Space&"smtpserver") = "smtp.sina.com"
- .Item(MS_Space&"smtpserverport") = 25
- .Item(MS_Space&"smtpauthenticate") = 1
- .Item(MS_Space&"sendusername") = "yonghuming"
- .Item(MS_Space&"sendpassword") = "mima"
- .Update
- End With
- Email.Send
- Set Email=Nothing
- End Sub
复制代码
VBS不是很懂,可?