帮忙做一个VBS,可以用我会给20分。

来源:百度知道 编辑:UC知道 时间:2024/09/22 21:28:20
做一个VBS,打开某程序1秒就关。(“某程序”用“***.exe"表示)
可以用我会给20分。

我有一个,现在还在用,很不错的,功能比你要求的还多点,可以定时的:

dim time_start, time_end, myshell
set myshell = Wscript.CreateObject("Wscript.Shell")
time_start = #19:30:00#
time_end = #22:30:00#

do
do
if time() > time_start and time() <time_end then
'msgbox("在这个时间内,是对的")
exit do
else
'msgbox("不在这个时间内,不会运行后面的程序,3秒后继续循环!")
wscript.sleep 600000
end if
loop
'msgbox("成功啦~~~~~~~~~")
wscript.sleep 300000

dim bag,pipe,w
w="wmplayer.exe"
set bag=getobject("winmgmts:\\.\root\cimv2")
set pipe=bag.execquery("select * from win32_process where name='wmplayer.exe'")
for each i in pipe
dim e
e=i.Name
if lcase(e)=lcase(w) then
i.terminate()
msgbox("请不要在这个时间里打开播放器")

end if
next
loop

上面的是测试代码,完全可以用的,你可以按你的要求改改,具体功能是这样的:每天晚上定时关闭