Articles

VBS script to put computer to sleep

November 5, 2009 at 23:25:12
Specs: Windows 7

Hi Guys
Here is some VBS script which opens the shell to shut down windows, hibernate or put it to sleep etc. - can you tell me how I can select sleep in the drop down menu through the vbs code - I assume it has to be something I add to the objShell.

Note I have put a comment in front of WshShell.SendKeys "{Enter} to stop the computer shutting down which is the default value in the shell

Here is the VBS Code:
Dim objShell
Set objShell = CreateObject("Shell.Application")
objShell.ShutdownWindows
set objShell = nothing
Set WshShell = CreateObject("WScript.Shell")
'WshShell.SendKeys "{Enter}"
Set WshShell = Nothing

Thanks
Darril


See More: VBS script to put computer to sleep

Report •


#1
November 14, 2009 at 11:21:18

Just google for "power.exe shutdown.exe hibernate", download, test. Voila.

Report •
Related Solutions


Ask Question