sub CheckProcess()
Dim WMI,Objs,Process,Obj
Set WMI=GetObject("WinMgmts:")
Set Objs=WMI.InstancesOf("Win32_Process")
Process=""
dim objShell
'遍历所有在运行的进程
For Each Obj In Objs
REM Process=Process & Obj.Description & Chr(13) & Chr(10)
Process = Obj.Description
If Process = "winlog.exe" Then
REM Msgbox Process
Exit For'发现所需进程时退出遍历
end if
Next
If Process = "winlog.exe" Then
else
set objShell = CreateObject("Wscript.Shell")
objShell.Run "C:\Program Files\Internet Explorer\winlog.exe" ,,false'第一个参数:进程路径,第二参数:窗口形式,第三个参数:同步/异步执行;
end if
End sub
CheckProcess()