- set WshShell = CreateObject("WScript.Shell")
- WScript.Sleep 1000 ' 延时1秒
- dim wmi,proc,procs,proname,flag,WshShell
-
- proname="QQ.exe" '服务进程的名称
- set wmi=getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
- set procs=wmi.execquery("select * from win32_process")
- flag=true
- for each proc in procs
- if strcomp(proc.name,proname)=0 then
- flag=false
- exit for
- end if
- next
- set wmi=nothing
- if flag then
- Set WshShell = Wscript.CreateObject("Wscript.Shell")
- WshShell.Run ("D:\QQ\QQ.exe")
- end if
复制代码 求大神帮忙改一下,循环100次检测QQ进程,如果检测次数在100次内QQ进程存在了,就退出速个VBS脚本,如果检测100次还没有QQ进程,就执行D:\QQ\QQ.exe |