VBS检测某进程,不存在则启动指定进程
option Explicitdim wmi,proc,procs,proname,flag,WshShell
Do
wscript.sleep 30000
proname="RunMe.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 ("C:\Progra~1\HC\hCard\RunMeC~1\First.exe")
end if
loop 这个还不错 学习了
页:
[1]