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 to write a vbs script that can shut down automatically at a fixed time

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

Share

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

This article mainly explains "how to write a vbs script that can automatically shut down on a regular basis". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "how to write a vbs script that can automatically shut down on a regular basis" together!

The copy code is as follows:

Dim mytime,myout1,myout2

mytime=null

mytime=InputBox("Please enter timing time (format 20:10:05)"&vblf&"If you want to count down shutdown, please enter countdown time"&vblf&"(unit/min)"&vblf&"Enter 'xxx' to shut down immediately"&vblf&"Exit point 'Cancel'," Timed 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("Timing succeeded! The computer will shut down at "&mytime&"! Please click 'Cancel' to abort shutdown! ",vbokcancel," timed shutdown ")

If myout1=vbcancel Then

wshshell.run "at /delete /y"

MsgBox "Shutdown cancelled! "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=guanji then

diaolei.run "rundll32.exe user.exe,exitwindows"

diaolei.run "shutdown -s -t 0"

elseif hua=2 then

guanji=inputbox("Please enter how many hours you want to shut down")

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 how many days you want to shut down")

if datediff("d",shijian,time)>=guanji then

diaolei.run "rundll32.exe user.exe,exitwindows"

diaolei.run "shutdown -s -t 0"

endif

Thank you for reading, the above is "how to write can automatically shut down the timing of the vbs script" content, after learning this article, I believe we can write automatic shutdown of the timing of the vbs script this issue has a deeper understanding, the specific use of the need for everyone to practice verification. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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