Dim ActionId
ActionId = 1 ' 0 logoff, 1 shutdown, 2 reboot,
Actiontime = "2006-1-4 13:42:30" ' Shutdown or restart time
function ShutDown ()
Dim Objshell
Set Objshell = WScript.CreateObject ("Wscript.Shell")
Dim application
Set application = CreateObject ("Shell.application.1")
Application.shutdownwindows ()
Dim UPI
For UPI = 0 to 4
Wscript.Sleep (50)
Objshell.sendkeys ("{Up}")
Next
For UPI = 1 To ActionId
Wscript.Sleep (50)
Objshell.sendkeys ("{Down}")
Next
' When using, please remove the following annotation characters
' Objshell.sendkeys (' {ENTER} ')
End Function
While True
If DateDiff ("s", now, Actiontime) < 0 Then
ShutDown ()
End If
Wscript.Sleep (5*1000)
Wend
' Save the above code as a VBS file, such as: Shutdown.vbs, and then double-click or right-click on the file to open the command prompt.
' If you set the reboot, the shutdown dialog will appear.
' Directly below the code program will appear the Shutdown dialog box, the final return comment off, normal use, please remove the annotation character.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.