可以定时自动关机的vbs脚本_vbs教程-查字典教程网
可以定时自动关机的vbs脚本
可以定时自动关机的vbs脚本
发布时间:2016-12-28 来源:查字典编辑
摘要:复制代码代码如下:Dimmytime,myout1,myout2mytime=nullmytime=InputBox("请输入定时时间(格式...

复制代码 代码如下:

Dimmytime,myout1,myout2

mytime=null

mytime=InputBox("请输入定时时间(格式20:10:05)"&vblf&"如果想倒计时关机,请输入倒计时时间"&vblf&"(单位/分钟)"&vblf&"输入‘xxx'可以马上关机"&vblf&"退出点‘取消'","定时关机","1")

Setwshshell=wscript.createobject("wscript.shell")

IfIsNumeric(mytime)=FalseThen

IfIsDate(mytime)=TrueThen

wshshell.run"at"&mytime&"shutdown-s"'定时关机在任务列表中

myout1=MsgBox("定时成功!电脑将在"&mytime&"关机!放弃关机请点‘取消'!",vbokcancel,"定时关机")

Ifmyout1=vbcancelThen

wshshell.run"at/delete/y"

MsgBox"关机已取消!",64,"定时关机"

EndIf

Else

Ifmytime="xxx"Then

wshshell.run"shutdown-s-t0"

EndIf

MsgBox"输入错误!请重新输入!",64,"定时关机"

EndIf

Else

Ifmytime>600Ormytime<=0Then

MsgBox"输入错误!倒计时不能多于10小时(600分钟)!",64,"定时关机"

wscript.quit

EndIf

wshshell.run"shutdown-s-t"&mytime*60

myout2=MsgBox("设置成功!电脑将在"&mytime&"分钟后关机!放弃关机请点‘取消'!",vbokcancel,"定时关机")

Ifmyout2=vbcancelThen

wshshell.run"shutdown-a"

MsgBox"关机已取消!",64,"定时关机"

EndIf

EndIf

复制代码 代码如下:

setdiaolei=createobject("wscript.shell")

dimshijian,guanji,hua

shijian=time

hua=inputbox("请输入你要用什么单位关机1代表分钟2代表小时3代表天")

ifhua=1then

guanji=inputbox("请输入你要几分钟后关机")

ifdatediff("m",shijian,time)>=guanjithen

diaolei.run"rundll32.exeuser.exe,exitwindows"

diaolei.run"shutdown-s-t0"

elseifhua=2then

guanji=inputbox("请输入你要几小时后关机")

ifdatediff("h",shijian,time)>=guanjithen

diaolei.run"rundll32.exeuser.exe,exitwindows"

diaolei.run"shutdown-s-t0"

elseifhua=3then

guanji=inputbox("请输入你要几天后关机")

ifdatediff("d",shijian,time)>=guanjithen

diaolei.run"rundll32.exeuser.exe,exitwindows"

diaolei.run"shutdown-s-t0"

endif

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新vbs学习
    热门vbs学习
    脚本专栏子分类