Windows 10 Tip: How To Put Computer in Sleep Mode from Command Line


It’s fairly easy to do to put a Windows computer in sleep mode through the Start menu or the Power button. But it would be nice to know if and how to do so from a command line.

Start Sleep - Windows 10 Tip: How To Put Computer in Sleep Mode from Command Line

Here are a few options:

Built-in command line

Simply put, running the following command puts the computer in Sleep mode.

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

Well, it’s actually not accurate. If the hibernation is enabled, the same command actually puts the computer in hibernation instead of sleeping.

You will need to turn the Hibernation off if you need to put the computer in sleep mode.

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

The last one in line re-enables the Hibernation after the computer wakes up. You better put the above commands in a batch file so it all runs automatically. The batch file will need the local admin rights to run, meaning to be executed from an elevated command prompt, but you can overcome this by following this cool tip.

Sysinternals’ PsShutdown

Microsoft Sysinternals has a tool called PsShutdown that can simplify the process with one signal command without disabling/enabling the hibernation.

psshutdown -d -acceptula

The -acceptula is to automatically accept and agree to the user agreement using the tool.

NirSoft’s NirCmd

NirSoft also has a general command line called NirCmd that can do the same as well, such as:

nircmd standby

You can use other tools like AutoHotKey to record your steps to put a computer in sleep or the Wizmo tool. But both PsShutdown and NirCmd work better. Note that some of the anti-virus system may treat NirCmd as a malware so if that happens, going with PsShutdown seems to be the best options here.


Please enter your comment!
Please enter your name here