Home » Questions » Computers [ Ask a new question ]

What is the command to use to put your computer to sleep (not hibernate)?

What is the command to use to put your computer to sleep (not hibernate)?

I want to put my Windows PC (Windows 7) into a sleep state via command line (so I can bind to macro button on keyboard).

Asked by: Guest | Views: 75
Total answers/comments: 5
Guest [Entry]

"I found a solution. I installed a freeware program called AutoHotKey and recorded the steps to invoke Start Menu -> Sleep into a script file. Then I complied the script file into a stand-alone executable SleepWin7.exe.

Now I simply run SleepWin7.exe to put my computer into hybrid sleep.

You may uninstall AutoHotKey if this is all you need it for.

Update: The above solution doesn't work when the user isn't logged in, i.e. Windows 7 Login Screen. (My computer wakes up at 4am every Sunday to perform weekly backup, which is done without user login.) In such case, the Wizmo program still works:

wizmo.exe quiet standby!"
Guest [Entry]

"See the free utility of Wizmo, which can do very many things.
The command you're looking for is probably:

wizmo standby"
Guest [Entry]

I've been using this SLEEP.EXE utility for years. It works well, and you don't have to remember what arguments to give it for suspend mode (its default form of "sleep").
Guest [Entry]

"to disable hibernate mode you need to use

powercfg -h off

now, rundll32 powrprof.dll,SetSuspendState will put your station in stanby mode

[EDIT]

actually I can't setup for an hybrid sleep because I have a laptop (a state that is not available on mobile stations), for hybrid sleep you need to have hibernation enabled and some say that rundll32 powrprof.dll,SetSuspendState trigger the default sleep mode in your control-panel\power-management settings. please try if rundll32 powrprof.dll,SetSuspendState hybrid sleep give some results."
Guest [Entry]

"Make a bat file, where 600 is delay in seconds.

ping -n 600 -w 1 127.0.0.1 > nul

powercfg -h off

%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby"