定时关机小程序
界面:
代码如下:
<head>
<title>定时关机小程序</title>
<hta:application
applicationname=hta test
borde=thin
borderstyle=raised
icon=c:\windows\system32\control.exe
scroll=no
singleinstance=yes
maximizebutton=no
minimizebutton=no
windowstate=normal
>
</head>
<script language=vbscript>
sub window_onload
strcomputer = .
set objwmiservice = getobject(winmgmts:\\ & strcomputer & \root\cimv2)
set colitems = objwmiservice.execquery(select * from win32_desktopmonitor)
for each objitem in colitems
inthorizontal = objitem.screenwidth
intvertical = objitem.screenheight
next
intleft = (inthorizontal - 240) / 2
inttop = (intvertical - 500) / 2
window.resizeto 240,500
window.moveto intleft, inttop
end sub
sub onesub
set objectshell=createobject(wscript.shell)
ireturn = objectshell.run(shutdown -s -f -t 1800, 0, true)
end sub
sub twosub
set objectshell=createobject(wscript.shell)
ireturn = objectshell.run(shutdown -s -f -t 2700, 0, true)
end sub
sub thrsub
set objectshell=createobject(wscript.shell)
ireturn = objectshell.run(shutdown -s -f -t 3600, 0, true)
end sub
sub ok
if isnumeric(text.value) then
overtime = text.value * 60
set objectshell=createobject(wscript.shell)
ireturn = objectshell.run(shutdown -s -f -t & overtime, 0, true)
else
msgbox 请输入一个有效的数字。
end if
end sub
sub shutdown
set objectshell=createobject(wscript.shell)
ireturn = objectshell.run(shutdown -s -t 0, 0, true)
end sub
sub eshutdown
set objectshell=createobject(wscript.shell)
ireturn = objectshell.run(shutdown -a, 0, true)
end sub
</script>
<body>
<br>
<center><div><input type=button style=height:30px;line-height:20px;border:1px solid #aaa; value=30 分钟后关闭计算机 name=run_button onclick=onesub><p> </div></center>
<center><div><input type=button style=height:30px;line-height:20px;border:1px solid #aaa; value=45 分钟后关闭计算机 name=run_button onclick=twosub><p> </div></center>
<center><div><input type=button style=height:30px;line-height:20px;border:1px solid #aaa; value=60 分钟后关闭计算机 name=run_button onclick=thrsub><p> </div></center>
<br>
自定义时间(分钟):<p>
<input type=text name=text id=text style=height:23px;width:120px;line-height:20px;border:1px solid #aaa;/>
<input name=submit type=submit style=width:50px;height:23px;line-height:20px;border:1px solid #aaa; value=确定 onclick=ok><p>
<br>
<center><div><input type=button style=height:30px;line-height:20px;border:1px solid #aaa; value=取消计划中的注销 name=run_button onclick=eshutdown><p> </div></center>
<center><div><input type=button style=height:30px;line-height:20px;border:1px solid #aaa; value= 关闭计算机 name=run_button onclick=shutdown><p> </div></center>
<br>
<center><div><a href=http://www.enun.net/>http://www.enun.net/</a></div></center>
</body>
2025国考·省考课程试听报名