Copy Code code as follows:
Dim Mytime,myout1,myout2
Mytime=null
Mytime=inputbox ("Please enter timed time (format 20:10:05)" &vblf& "if you want to count down, please enter the countdown time" &vblf& "(unit/minute)" &vblf& "input ' xxx ' can be shut down immediately ' &vblf& ' exit point ' Cancel ', ' Timer shutdown ', ' 1 '
Set wshshell=wscript.createobject ("Wscript.Shell")
If IsNumeric (mytime) =false Then
If IsDate (mytime) =true Then
Wshshell.run "at" &mytime& "shutdown-s" ' Timed Shutdown in task List
Myout1=msgbox ("Timed success!") The computer will be shut down in "&mytime&"! Give up the shutdown please click ' Cancel '! ", vbOKCancel," timed shutdown ")
If Myout1=vbcancel Then
Wshshell.run "at/delete/y"
MsgBox "Shutdown canceled!" ", 64," timed shutdown "
End If
Else
If mytime= "xxx" Then
Wshshell.run "Shutdown-s-T 0"
End If
MsgBox "Input Error!" Please re-enter! ", 64," timed shutdown "
End If
Else
If mytime>600 Or mytime<=0 Then
MsgBox "Input Error!" The countdown can not be more than 10 hours (600 minutes)! ", 64," timed shutdown "
Wscript.Quit
End If
Wshshell.run "Shutdown-s-T" &mytime*60
Myout2=msgbox ("Set success!") The computer will be shut down after "&mytime&" Minutes! Give up the shutdown please click ' Cancel '! ", vbOKCancel," timed shutdown ")
If Myout2=vbcancel Then
Wshshell.run "Shutdown-a"
MsgBox "Shutdown canceled!" ", 64," timed shutdown "
End If
End If
Copy Code code as follows:
Set Diaolei=createobject ("Wscript.Shell")
Dim Shijian,guanji,hua
Shijian=time
Hua=inputbox ("Please enter what unit you want to shut down 1 for the minute 2 for the Hour 3 for the day")
If Hua=1 Then
Guanji=inputbox ("Please enter you want a few minutes after shutdown")
If DateDiff ("M", Shijian,time) >=guanji Then
Diaolei.run "Rundll32.exe user.exe,exitwindows"
Diaolei.run "Shutdown-s-T 0"
ElseIf hua=2 Then
Guanji=inputbox ("Please enter you want to shut down after a few hours")
If DateDiff ("H", Shijian,time) >=guanji Then
Diaolei.run "Rundll32.exe user.exe,exitwindows"
Diaolei.run "Shutdown-s-T 0"
ElseIf Hua=3 Then
Guanji=inputbox ("Please enter you need a few days after shutdown")
If DateDiff ("D", Shijian,time) >=guanji Then
Diaolei.run "Rundll32.exe user.exe,exitwindows"
Diaolei.run "Shutdown-s-T 0"
endif