Saturday 28 October 2017

windows 7 - 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).


The power button on the PC is setup to but the computer to sleep (but it's down on the floor and I'm too lazy to reach down) it exactly how I want it (sleeps using hybrid mode in case I loose power)


The sleep command on the shutdown menu also works.


most info I found says to use;


%windir%\system32\rundll32.exe PowrProf.dll, SetSuspendState 0,1,0

But this puts the computer in hibernate mode. I do have hibernate disabled but using hybrid sleep.


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



Answer



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!



No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...