帮忙修改改vbs代码,现在可以运行后退出某个程序,我想要的是可以在一个指定时间后退出某个程序
optionExplicitdimwmi,proc,procs,proname,flag,WshShellproname="MyUpdate.exe"'setwmi=ge...
option Explicit
dim wmi,proc,procs,proname,flag,WshShell
proname="MyUpdate.exe" '
set wmi=getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
set procs=wmi.execquery("select * from win32_process")
flag=False
for each proc in procs
if strcomp(proc.name,proname)=0 then
flag=true
exit for
end if
next
set wmi=nothing
if flag then
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run "taskkill /f /im " & proname,0
WScript.Quit
Else
WScript.Quit
end if 展开
dim wmi,proc,procs,proname,flag,WshShell
proname="MyUpdate.exe" '
set wmi=getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
set procs=wmi.execquery("select * from win32_process")
flag=False
for each proc in procs
if strcomp(proc.name,proname)=0 then
flag=true
exit for
end if
next
set wmi=nothing
if flag then
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run "taskkill /f /im " & proname,0
WScript.Quit
Else
WScript.Quit
end if 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询