0

I want to regularly use both sleep and hibernate on my computer, so I want a simple non-compound hotkey to access both of them. Currently, I hibernate my laptop whenever I move it, but I think this will cause my SSD to fail sooner than it should. I already have a hotkey for hibernate (ctrl-shift-f1). Unfortunately, when I went in to create a sleep shortcut, the recommended commands hibernated my computer instead of sleeping it. According to people asking similar questions, the commands I have tried require hibernate to be disabled, which is unacceptable for my use case.

Question: Is there a way I can make Ctrl+Shift+F1 hibernate my computer and Ctrl+Shift+F2 sleep my computer? (the specific hotkeys don't matter).

I tried the following two batch files:

hibernate.bat:

powercfg -h on
rundll32.exe powrprof.dll,SetSuspendState 0,1,0 

sleep.bat:

powercfg -h off
rundll32.exe powrprof.dll,SetSuspendState 0,1,0 
powercfg -h on

These scripts technically work, but not in a way I like. Unfortunately, powercfg requires admin permissions, and I don't want to have to click an admin dialog window every time I want to sleep or hibernate my computer (I also don't want to get in the habit of automatically accepting these dialog messages when they pop up). Plus, I want non-admin accounts to be able to run this script. A solution where I can successfully run these batch files as admin without the dialog would be a good answer (without disabling the whole authentication system). Is there a functionality like the sudoer's file from Linux?

My computer can both sleep and hibernate through the shutdown menu.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.