Computing.Net > Forums > Windows 7 > VBS script to put computer to sleep

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VBS script to put computer to sleep

Reply to Message Icon

Name: Darril
Date: November 5, 2009 at 23:25:12 Pacific
OS: Windows 7
Product: Microsoft Windows 7 ultimate
Subcategory: Software Problems
Tags: vbs sleep
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: tvc
Date: November 14, 2009 at 11:21:18 Pacific
Reply:

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


0
Reply to Message Icon

Related Posts

See More


Explorer not responding cannot access


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: VBS script to put computer to sleep

Denied access to HD www.computing.net/answers/windows-7/denied-access-to-hd/110.html

XP to Windows 7 www.computing.net/answers/windows-7/xp-to-windows-7/259.html

Win7 isn't an entirely MS-developed product www.computing.net/answers/windows-7/win7-isnt-an-entirely-msdeveloped-product/441.html