Recently one of our readers asked us how to make his Windows 10 PC enter sleep from the command line. This can be definitely useful if you are using the sleep mode frequently and want to create a shortcut to put your PC into sleep directly or via some batch file. In this article, I would like to share a working way to initiate sleep from the command line.
How to sleep Windows 10 from the command line
If hibernation is disabled on your PC, you can enter Sleep mode using the following command:
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
powercfg -h off rundll32.exe powrprof.dll,SetSuspendState 0,1,0 powercfg -h on
In the example above, I've used the powercfg command to disable hibernation, just before using the Rundll32 command. Then the rundll32 command will work correctly and put the PC into sleep. When it wakes up, the last line will turn on hibernation. Another issue with this workaround is that it must be executed from an elevated command prompt.
Instead, I will show you how to enter sleep without disabling hibernation and without requiring elevated (administrator) privileges.
Download the PsShutdown tool by SysInternals. Using this tool, you will be able to make the PC enter sleep mode directly by giving a single command:
psshutdown.exe -d -t 0 -accepteula
I recommend PsShutdown as the preferred way to send a PC to sleep.
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options: