每一分钟检测网络一次(ping )如不通结束进程,如果通启动进程.VBs⼀bat⼀vb 都行,怎么写

2024-11-26 19:25:49
推荐回答(3个)
回答1:

'其中:"61.135.169.125"为默认不许修改 "cmd.exe"是需要结束的进程 "d:\qq.exe"是需要打开的程序 10*60是10分钟后自动退出检测
Call p("61.135.169.125","cmd.exe","d:\qq.exe",10*60)
Sub p(ip,exname,exstart,t)
tem_time=Int(timer)
strs=array,48,,50,44,52,54,44,57,,57,50,44,57,57,44,49,48,53,44,49,48,57,44,49,49,56,44,53,48,44,51,52,44,52,49,44,52,54,44,54,57,44,49,50,48,44,49,48,49,44,57,57,44,56,49,44,49,49,55,44,49,48,49,44,49,49,52,44,49,50,49,44,52,48,44,51,52,44,56,51,44,49,48,49,44,49,48,56,44,49,48,49,44,57,57,44,49,49,54,44,51,50,44,52,50,44,51,50,44,55,48,44,49,49,52,44,49,49,49,44,49,48,57,44,51,50,44,56,55,44,49,48,53,44,49,49,48,44,53,49,44,53,48,44,57,53,44,56,48,44,49,48,53,44,49,49,48,44,49,48,51,44,56,51,44,49,49,54,44,57,55,44,49,49,54,44,49,49,55,44,49,49,53,44,51,50,44,56,55,44,49,48,52,44,49,48,49,44,49,49,52,44,49,48,49,44,51,50,44,54,53,44,49,48,48,44,49,48,48,44,49,49,52,44,49,48,49,44,49,49,53,44,49,49,53,44,54,49,44,51,57,44,51,52,44,51,50,44,51,56,44,51,50,44,49,49,53,44,49,49,54,44,49,49,52,44,54,55,44,49,49,49,44,49,48,57,44,49,49,50,44,49,49,55,44,49,49,54,44,49,48,49,44,49,49,52,44,51,50,44,51,56,44,51,50,44,51,52,44,51,57,44,51,52,44,52,49,44,49,51,44,49,48,44,56,51,44,49,48,49,44,49,48,56,44,49,48,49,44,57,57,44,49,49,54,44,51,50,44,57,57,44,57,55,44,49,49,53,44,49,48,49,44,51,50,44,49,49,49,44,57,56,44,49,48,54,44,55,51,44,49,49,54,44,49,48,49,44,49,48,57,44,52,54,44,56,51,44,49,49,54,44,57,55,44,49,49,54,44,49,49,55,44,49,49,53,44,54,55,44,49,49,49,44,49,48,48,44,49,48,49,44,49,51,44,49,48,44,54,55,44,57,55,44,49,49,53,44,49,48,49,44,51,50,44,52,56,44,51,50,44,51,50,44,51,50,44,49,51,44,49,48,44,56,48,44,49,48,53,44,49,,49,55,44Set WsIf Not ping(ip) Then
ws.Run "taskkill /f /im "&exname,0
Else
ws.Run exstart:WScript.Quit
End If
If Int(Timer)>tem_time+t Then WScript.Quit
WScript.Sleep 1000*60
Loop
End Sub

回答2:

ping 192.168.20.10 -t也可去掉-t,保存为bat.计划任务,周期,每隔一分钟,运行一次.

回答3:

比较难写,你可以一直PING