VBS进程监控
答案:1 悬赏:20 手机版
解决时间 2021-03-22 16:15
- 提问者网友:wodetian
- 2021-03-22 03:18
每10秒钟检测一次进程 发现1.exe就运行2.exe
最佳答案
- 五星知识达人网友:七十二街
- 2021-03-22 03:30
set ws = createobject("wscript.shell")
exe1="notepad.exe"
exe2 = "calc.exe"
check = false
while(true <> check )
check = isProcessExists(exe1)
wscript.sleep 10000
wend
ws.run exe2
Private Function isProcessExists(strExeName)
strComputer = "."
Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_Process")
For Each wbemObject In wbemObjectSet
namedata = wbemObject.Name
If strExeName = namedata Then
isProcessExists = true
End If
Next
End Function
'写完了,你把exe1里面放1.exe的路径,exe2里面放2.exe的路径
exe1="notepad.exe"
exe2 = "calc.exe"
check = false
while(true <> check )
check = isProcessExists(exe1)
wscript.sleep 10000
wend
ws.run exe2
Private Function isProcessExists(strExeName)
strComputer = "."
Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_Process")
For Each wbemObject In wbemObjectSet
namedata = wbemObject.Name
If strExeName = namedata Then
isProcessExists = true
End If
Next
End Function
'写完了,你把exe1里面放1.exe的路径,exe2里面放2.exe的路径
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯