kill "wscript.exe",1 '可能是脚本问题吧。检测一个的时候就是检测二个,把此代码保存为VBS,复制一分,运行第一个,再运行复制的那个,你会发现一会儿,两个WSCRIPT进程都给关闭了。郁闷,我只想当第二个VBS运行时关掉第一个VBS的进程。帮我修改修改代码吧
do
msgbox ("1")
msgbox ("2")
msgbox ("3")
msgbox ("4")
msgbox ("5")
loop
function kill(pcs,xx)
if jc(pcs,1) then
on error resume next
Set objwmiservice=getobject("winmgmts:\\.\root\cimv2")
Set colprocesslist=objwmiservice.execquery ("select * from
win32_process where name='"&pcs&"' ")
for each objprocess in colprocesslist
objprocess.terminate()
next
if xx=1 then taskkill=1
end if
end function
function jc(wr,gs)
on error resume next
wscript.sleep 5000
set y=getobject("winmgmts:\\.\root\cimv2")
set x=y.execquery("select * from win32_process where name='"&wr&"'")
i=0
for each j in x
i=i+1
next
if not er then
if i>gs then jc=true
else
jc=1
end if
end function
function er()
if err.number=0 then
er=false
else
err.clear
er=true
end if
end function
do
msgbox ("1")
msgbox ("2")
msgbox ("3")
msgbox ("4")
msgbox ("5")
loop
function kill(pcs,xx)
if jc(pcs,1) then
on error resume next
Set objwmiservice=getobject("winmgmts:\\.\root\cimv2")
Set colprocesslist=objwmiservice.execquery ("select * from
win32_process where name='"&pcs&"' ")
for each objprocess in colprocesslist
objprocess.terminate()
next
if xx=1 then taskkill=1
end if
end function
function jc(wr,gs)
on error resume next
wscript.sleep 5000
set y=getobject("winmgmts:\\.\root\cimv2")
set x=y.execquery("select * from win32_process where name='"&wr&"'")
i=0
for each j in x
i=i+1
next
if not er then
if i>gs then jc=true
else
jc=1
end if
end function
function er()
if err.number=0 then
er=false
else
err.clear
er=true
end if
end function





