vbscript - Restarting Computer via VBS -


I need fewer dog / more effective methods to restart my computer via VBS. Below is an example of the code I have given so far. What is the more effective way to start the other again, SendKeys method ??

  Options clear dim obj set obj = creatobject ( "wscript.shell") obj.run "CMD" Wscriptksleep 300 obj Ksendkeys "Shutdown / R" ObjkSendKeys "{ENTER} "obj.SendKeys" exit "obj.SendKeys" {ENTER} "wscript.quit   

Thank you

you can use winmgmts, this script takes an argument for the computer name, but can be easily converted to use

  If wscript.Arguments.Count = 0 then strComputer = inputbox ("Enter the computer's name", "Enter the computer's name") if strComputer = "" then wsc ript.quit Else strCOmputer = Wscript.Arguments.Item (0) End If objWMIService = GetObject ( "winmgmts:" _ & amp; "{impersonation Livl = impersonation, (shutdown)}! \\" & amp; ;;;; ;;;;;;;;; & gt; _ ( "* Choose from Win32_OperatingSystem") colOperatingSystems objOperatingSy Stem.Reboot () for each objOperating system Next    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -