Windows has a built-in sleep mode to save energy and extend battery life. You can access it from the Power User menu (Windows key + X) or the Start menu’s power options. Generally, most users use the mouse pointer to select the sleep option to put Windows to sleep. Alternatively, you can also use a keyboard shortcut to put Windows to sleep.
This article shares with you the built-in Windows sleep shortcut and also shows another way to create a custom keyboard shortcut to activate Windows sleep mode. The custom shortcut is especially useful if you don’t like the built-in sleep shortcut or want a quicker way.
Table of contents:
Windows Sleep Mode Keyboard Shortcut
To put Windows to sleep with the default keyboard shortcut, press “Windows key + X” to open the power user menu and then press the “U” and “S” keys on your keyboard one after another. This action will put your computer to sleep.
Create Custom Keyboard Shortcut to Put Windows to Sleep
If you find the default keyboard shortcut to set Windows to sleep clunky or hard to use, you can create your own Windows sleep shortcut using the AutoHotKey application. Here’s how.
1. Download and install AutoHotKey.
First, download the AutoHotKey application using the below link. Next, double-click on the installer file and follow the installation wizard to install AutoHotKey.
2. Create a text file on the desktop and rename it to “SleepShortcut.ahk.”
After installing AutoHotKey, right-click on the desktop and choose the “New > Text document” option to create a new text file. After creating the text file, rename it to “SleepShortcut.ahk” (without quotes). Click “Yes” in the confirmation prompt. This turns the normal text file into an AutoHotKey script file.
3. Open the “SleepShortcut.ahk” file.
Once you’ve created a text file and renamed it, we can open and edit it. To do that, right-click on the file and select the “Show more options > Edit Script” option. This action opens the file in Notepad.
Note: If you see a prompt asking you to select a text editor, select Notepad and click “Ok.”
4. Paste the below script in the file and save it.
Copy the script below with the “Ctrl + C” shortcut and paste it into the file with the “Ctrl + V” shortcut. After that, save it by pressing the Ctrl + S shortcut or selecting the “File > Save” option. Close the editor window.
;Custom Windows Sleep Shortcut
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
By default, the below script uses “Shift + Windows key + Delete” to sleep. If you don’t like it, you can modify the “#+Del” part of the script to add your own shortcut. If you don’t know, Windows, Shift, Ctrl, and Alt keys are represented with #, +, ^, ! symbols respectively.
For example, if you want to use Windows + Alt + S to put Windows to sleep, you should replace “#+Del” with “#!S” (without quotes).
If you want to learn more about AutoHotKey keys and how to write a shortcut, follow the links below.
5. Run the .ahk script file.
After creating the script file, double-click on the file to run it. As soon as you do that, the script file launches and sits silently in the taskbar.
6. Use the custom shortcut to put Windows to Sleep.
Now, press the custom shortcut to put Windows to sleep. For example, if you are using the script I’ve given you, press the Windows key + Shift + Del shortcut. If you modified the script to add your own shortcut, then press that shortcut.
That is all. It is that simple to create your own shortcut to activate Windows sleep mode. If you want to, you can add this script to Windows Startup so that it runs as soon as you start Windows and removes the need to launch it manually. Here’s how to add an AutoHotKey script to Windows startup.
I hope this simple and easy Windows how-to guide helped you.
If you are stuck or need help, send an email, and I will try to help as much as possible.