rundll32.exe powrprof.dll,SetSuspendState
But it didn't work for me because it hibernates the machine instead of Sleep, which is the case if you have hibernate enabled - as most of us have.
Dim objShell
Set objShell = CreateObject("Shell.Application")
objShell.ShutdownWindows
set objShell = nothing
Set WshShell = CreateObject("WScript.Shell")
With objShell
WScript.Sleep 200
WshShell.AppActivate "Shut Down Windows"
WshShell.SendKeys "ss"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{Enter}"
End With
Set objShell=Nothing
@ echo off
> %temp%\Sleep.vbs echo Dim objShell
>> %temp%\Sleep.vbs echo Set objShell = CreateObject("Shell.Application")
>> %temp%\Sleep.vbs echo objShell.ShutdownWindows
>> %temp%\Sleep.vbs echo set objShell = nothing
>> %temp%\Sleep.vbs echo Set WshShell = CreateObject("WScript.Shell")
>> %temp%\Sleep.vbs echo With objShell
>> %temp%\Sleep.vbs echo WScript.Sleep 200
>> %temp%\Sleep.vbs echo WshShell.AppActivate "Shut Down Windows"
>> %temp%\Sleep.vbs echo WshShell.SendKeys "ss"
>> %temp%\Sleep.vbs echo WshShell.SendKeys "{TAB}"
>> %temp%\Sleep.vbs echo WshShell.SendKeys "{Enter}"
>> %temp%\Sleep.vbs echo End With
>> %temp%\Sleep.vbs echo Set objShell=Nothing
wscript.exe %temp%\Sleep.vbs
del %temp%\Sleep.vbs
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)