Advertisement

How to sleep Windows 10 from the command line

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.

Windows 10 banner logo devs 02Windows10 only allows the hardware Power button or the Start Menu power button to enter Sleep (standby) mode. It does not provide a command line tool to directly enter sleep.

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:

Advertisеment

rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Windows 10 sleep command 1But if you have enabled hibernation, then the above command hibernates the PC instead of entering sleep mode. So you need to apply a workaround which isn't exactly ideal, something like this.

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

Windows 10 sleep command 2

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.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisеment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

4 thoughts on “How to sleep Windows 10 from the command line”

  1. The 0,1,0 parameters don’t work because SetSuspendState was never designed to be invoked by rundll32! All recent version of Windows have a forgiving rundll32 implementation that allows you to corrupt the stack but you are still passing random parameters to the function you are calling. See https://blogs.msdn.microsoft.com/oldnewthing/20040115-00/?p=41043

  2. Brilliant tip, I’ve always uses the elevated command prompt way and disabled Hibernation to sleep, using your tip is very useful, thanks for sharing.

  3. The only thing that worked for me on Windows 10 Pro version 2004 was the file called Sleep.exe which was on Softpedia website by searching for “Sleep Shortcut” (developer otax)
    or
    https://www.softpedia.com/get/System/Launchers-Shutdown-Tools/Sleep-Shortcut-for-Windows-10.shtml

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.