怎样用vbs判断一个程序是否正在运行?
来源:百度知道 编辑:UC知道 时间:2024/05/14 14:33:31
怎样用vbs判断一个程序是否正在运行?
要求如下:
1.判断【程序1】是否运行,如果正在运行则启动【程序2】
2.如果没有运行,则先启动【程序1】,然后启动【程序2】
要求如下:
1.判断【程序1】是否运行,如果正在运行则启动【程序2】
2.如果没有运行,则先启动【程序1】,然后启动【程序2】
set r = createobject("wscript.shell")
for each ps in getobject("winmgmts:\\.\root\cimv2:win32_process").instances_
if ps.executablepath="c:\1.exe" then
r.run "c:\2.exe"
wscript.quit
end if
next
r.run "c:\1.exe"
r.run "c:\2.exe"
set r = nothing