VBScript when we sometimes need to let the computer automatically restart or shutdown, often use some automatic shutdown software to achieve, but these software in addition to need to install, many still need to charge. And there is no shortage of successful operation after installation.
In fact, you do not have to pay to purchase any Third-party software to achieve automatic shutdown or restart, with a simple VBScript on it
Put the following code into the file Shutdown.vbs, and then in the directory where the file set up a shut.bat batch file, and finally set a task scheduled to run Shut.bat can be implemented at timed shutdown or restart the computer. That is simple and economical, why not try it?
------------------------------------------------
Content of Shut.bat:
cscript Shutdown.vbs
------------------------------------------------
The content of Shutdown.vbs
' Program design, Global worldwide
' http://www.netInter.cn, professional to provide domain registration, virtual host services
' The above information and the text of the article is an inseparable part, so if you want to reprint this article, you must retain the above information.
' Downflag is a shutdown sign
' downflag=12 indicates forced shutdown of the computer
' Downflag=8 shut down the computer
' downflag=6 indicates forced restart of computer
' downflag=2 means reboot the computer
' Downflag=4 indicates forced logoff
' Here we use 12 to force the computer to shut down
Downflag=12
Set Win32_os=getobject ("winmgmts:{(Shutdown)}//./root/cimv2"). ExecQuery ("select * from Win32_OperatingSystem where Primary=true ")
For each OS in Win32_os
Os.win32shutdown (Downflag)
Next
Set win32_os=nothing