Dim actionid
Actionid = 1' 0 logout, 1 shutdown, 2 reboot,
Actiontime = "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
'Remove the downstream annotator when using it.
'Objshell. sendkeys ("{enter }")
End Function
While true
If datediff ("S", now, actiontime) <0 then
Shutdown ()
End if
Wscript. Sleep (5*1000)
Wend
'Set the aboveCodeSave as a vbs file, such as shutdown. vbs. Double-click the file or right-click the file and choose to open it with a command prompt,
'If you set the restart, the system will shut down dialog box appears.
'Directly run the following code:ProgramThe shutdown dialog box appears, and the last carriage return is commented out. Remove the annotator during normal use.