Get the App
SLTechnology News&Howtos  ›  Development  › 

How does vbs realize timing shutdown or restart?

Shulou Source: shulou.com Published: 2022-06-03 19:37:35 09月30日 Update

This article mainly explains "how to achieve timing shutdown or restart of vbs". The explanation in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn how to achieve timing shutdown or restart of vbs.

The code is as follows:

'A script that shuts down or restarts regularly and passes under windows 2000.

'code by haiwa 2005-11-7 dim ActionID ActionID = 1'0 logout, 1 shutdown 2 restart ActionTime = "2005-11-7 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 comments from the following line 'objShell.sendKeys ("{ENTER}") end function While true if DateDiff ("s", Now, ActionTime) < 0 then ShutDown () end if WScript.Sleep (5000000) wend. Thank you for reading. This is the content of "how to achieve timing shutdown or restart of vbs". After the study of this article I believe that you have a deeper understanding of how to realize the timing shutdown or restart of vbs, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Learning content code that is ideas situations articles time more comments knowledge knowledge points articles scripts follow questions practice push research verification Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn Microsoft Shulou Information NVidia