如何用VBS检测进程程序是否运行
展开全部
程序已经调试过 (vbs的哦~) ok~
do
Set Of = CreateObject("Scripting.FileSystemObject")
set ws=createobject("wscript.shell")
dim OK,oShell
OK=False
set bag=getobject("winmgmts:\\.\root\cimv2")
set pipe=bag.execquery("select * from win32_process where name='A程序进程名'")
For Each id In pipe
OK = True
Next
If not OK Then
ws.run"B程序的路径",0,ture
wscript.sleep 3000
ws.run"%Comspec% /李轿卖哪逗c"&"tskill B程序帆升名(要去掉.exe)",0,ture
end if
wscript.sleep 3000
loop
do
Set Of = CreateObject("Scripting.FileSystemObject")
set ws=createobject("wscript.shell")
dim OK,oShell
OK=False
set bag=getobject("winmgmts:\\.\root\cimv2")
set pipe=bag.execquery("select * from win32_process where name='A程序进程名'")
For Each id In pipe
OK = True
Next
If not OK Then
ws.run"B程序的路径",0,ture
wscript.sleep 3000
ws.run"%Comspec% /李轿卖哪逗c"&"tskill B程序帆升名(要去掉.exe)",0,ture
end if
wscript.sleep 3000
loop
展开全部
用批处理写就好了,vbs我不懂...
试试看:
dim str1,str2
str1="cmd /c tasklist|find /i ""A程序进程"" || start """" ""B程序路径"""
wscript.createobject("wscript.shell"掘枝).run str1,0
WScript.Sleep 3000
str2="cmd /c tasklist|find /i ""枝链B程序进程"" && taskkill /猛散孙im ""B程序进程"""
wscript.createobject("wscript.shell").run str2,0
试试看:
dim str1,str2
str1="cmd /c tasklist|find /i ""A程序进程"" || start """" ""B程序路径"""
wscript.createobject("wscript.shell"掘枝).run str1,0
WScript.Sleep 3000
str2="cmd /c tasklist|find /i ""枝链B程序进程"" && taskkill /猛散孙im ""B程序进程"""
wscript.createobject("wscript.shell").run str2,0
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询