手机
当前位置:查字典教程网 >脚本专栏 >vbs >可以定时自动关机的vbs脚本
可以定时自动关机的vbs脚本
摘要:复制代码代码如下: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脚本】相关文章:

远程启动终端服务的windows脚本ROTS.vbs

解锁注册表的vbs脚本

用vbs实现的瞬间关闭多个系统进程的脚本

vbs实现压缩文件夹的脚本

VBS实现工作表按指定表头自动分表

用vbs实现定时运行web文件的方法

收集的一些经典的vbs脚本大全

一个可以删除指定天数文件的vbs脚本

用vbs判断系统补丁的脚本

用vbs实现本地添加用户的脚本

精品推荐
分类导航