Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does vbs realize timing shutdown or restart?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report