Is there a command line tool to put Windows 8 to sleep?

20

9

Possible Duplicate: How can I put the computer to sleep from Command Prompt/Run menu in Windows Vista?

A few days ago I installed Windows 8. I first found the lack of the "shutdown" menu comical, but now it's starting to annoy me. There seems to be no normal way to put my computer to sleep. The closest I found was:

  1. Ctrl + Del + Del
  2. 2x Shift + Tab
  3. Enter
  4. Arrow down
  5. Enter

As an alternative, I'm now looking for a command line tool to put Windows 8 to sleep.

The closest I could find was:

shutdown /h

Which causes Windows to hibernate. Unfortunately, hibernate isn't sleep. You can't wake a computer from hibernation with a key: you have to press the power button. And the computer will go through the BIOS startup before waking from hibernation.

Has anyone found a convenient way to put Windows 8 to sleep?

Andomar

Posted 2012-08-19T17:58:40.760

Reputation: 1 221

Question was closed 2012-08-20T10:26:20.883

On my win 8.1 psshutdown does not work. running "c:\Windows\System32>psshutdown -d -t 0" leads to ".....Error shutting down system: The request is not supported." – Asu – 2017-08-16T21:15:45.907

@asu psshutdown comes from the sysinternals suite, you have to download it – Andomar – 2017-08-16T21:18:20.720

@Andomar I have. It would have printed "'psshutdown' is not recognized as an internal or external command, operable program or batch file" if I didn't. In my previous comment I have quoted the actual output of psshutdown. Instructions do not say that the whole archive must be unzipped into e.g. system32, so I have only copied psshutdown there – Asu – 2017-08-17T23:45:01.313

@Asu: no need to put it in system32, you can run it from anywhere. "Not supported" probably means your setup doesn't support sleep. Your BIOS might have S1 turned off, you may not have a hibernate file, or many other things. – Andomar – 2017-08-18T08:03:38.327

@Andomar Probably the BIOS then. It has no options I can change with regards to sleep. It is Asus t100, which is technically a tablet. – Asu – 2017-08-18T11:59:37.160

1@techie007: The accepted answer for that question does not list a working way to Sleep, as you can read in the comments. The psshutdown -d -t 0 command posted by Scott Chamberlain does work. – Andomar – 2012-08-19T18:49:26.167

1Just because the accepted answer isn't what you want, doesn't make it a different question. Scott Chamberland's "comment" on the other question is actually another answer. And you should up-vote it if you found it to be useful. :) – Ƭᴇcʜιᴇ007 – 2012-08-19T18:50:26.513

@techie007: Sounds like you're misreading "command" for "comment" in my comment. And I did of course upvote his answer :) – Andomar – 2012-08-19T18:55:17.610

You are correct, I thought it said Comment. :) – Ƭᴇcʜιᴇ007 – 2012-08-19T18:57:22.507

@DanielBeck: The other question is specifically marked Vista. It would not have solved my problem because the accepted answer is wrong (which makes it useless: nobody reads all answers & comments on a search.) I guess I'll be looking for a friendlier site for my windows 8 questions. – Andomar – 2012-08-20T05:48:49.023

I don't have psshutdown on my Win8 machine, or at least it is not recognised – dumbledad – 2013-05-02T17:57:42.597

1

@dumbledad: It's part of the Sysinternals tools from Microsoft.

– Andomar – 2013-05-02T18:00:22.667

Answers

24

Here are all of the power options, I hope you find these useful.

  • Shutdown:

    %windir%\System32\shutdown.exe -s
    
  • Reboot:

    %windir%\System32\shutdown.exe -r
    
  • Logoff:

    %windir%\System32\shutdown.exe -l
    
  • Standby (disable hibernation, execute the standby command, then re-enable hibernation after 2 seconds):

    powercfg -hibernate off  &&  start /min "" %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby  &&  ping -n 3 127.0.0.1  &&  powercfg -hibernate on
    
  • Sleep (same method as STANDBY, but this command):

    %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0
    
  • Hibernate:

    %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate
    

superuser

Posted 2012-08-19T17:58:40.760

Reputation: 3 297

1rundll32 should not be used for calling SetSuspendState because its signature doesn't match the one expected by rundll32. See: https://support.microsoft.com/en-us/kb/164787 and https://msdn.microsoft.com/en-us/library/windows/desktop/aa373201(v=vs.85).aspx – SergeyT – 2016-07-26T01:02:37.547

Thanks for your reply. For me, Standby is different from Sleep. Restarting from Standby requires pressing the power button and the BIOS routine. Restarting from Sleep requires pressing a key and is almost instant. – Andomar – 2012-08-19T18:43:02.893

I have added the Sleep command as well, but the thing is it will hibernate instead of sleep if you don't turn the hibernation off. – superuser – 2012-08-19T18:54:46.300

11

This question was answered by Scott Chamberlain in this answer. You can use the psshutdown tool from the Sysinternals Suite to put Windows 8 to sleep:

psshutdown -d -t 0

You can download the tool only or the entire suite.

These two suggestions won't work if hibernation is enabled:

%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby
wizmo standby

The question which Scott Chamberlain answered is for Vista, perhaps having a Windows 8 version is useful, at least for locating the original :)

Andomar

Posted 2012-08-19T17:58:40.760

Reputation: 1 221

rundll32 should not be used for calling SetSuspendState because its signature doesn't match the one expected by rundll32. See: https://support.microsoft.com/en-us/kb/164787 and https://msdn.microsoft.com/en-us/library/windows/desktop/aa373201(v=vs.85).aspx – SergeyT – 2016-07-26T01:05:27.050

2

I first found the lack of the "shutdown" menu comical

Windows 8 has a shutdown menu!

It's power icon under the "Settings" fly-out (move your mouse into a corner to see the fly-outs). You can use the Windows Key + i keyboard shortcut to bring up the settings fly-out directly. In summary:

  1. WinKey + i
  2. Click "Power"
  3. Click "Sleep"

Alternatively, pretty much any laptop made in the last 6 years can set the power button to put the computer to sleep on one press.

Joel Coehoorn

Posted 2012-08-19T17:58:40.760

Reputation: 26 787

On Windows 8.1 there are only two items in that dropdown thingie, "Shut down" and "Restart". It is missing "Sleep". – Peter Mortensen – 2015-08-06T17:54:07.000

Sleeping through the power icon requires 4 mouse or 6 keys clicks. Since I sleep my computer often I found that too cumbersome (not to mention error prone.) – Andomar – 2012-08-19T19:31:12.813

1@Andomar I see 3 clicks (same as in windows 7) – soandos – 2012-08-19T19:31:50.033

@soandos: I think "move to corner" is at least as much work as a click. Win7 was Ctrl-Esc Right-Arrow Enter, which flows nicely on the keyboard. It's a workstation, not a laptop. – Andomar – 2012-08-19T19:36:51.617

1Workstations have had the option to set the power button to sleep for even longer -- just not universally, and you may need to go into the bios to enable it. Alternatively, get a multimedia keyboard with a sleep button. – Joel Coehoorn – 2012-08-19T19:38:56.097

I can't reach my workstation's power button without crawling under the desk. I don't see how a programmable keyboard would help-- I'd still need to know what command to make it run, when the key was hit. – Andomar – 2012-08-19T19:43:28.877

1@andomar - you don't have to program it. Most multimedia keyboards come with a pre-programmed sleep button. – Joel Coehoorn – 2012-08-19T19:44:34.187

0

Not sure about Windows 8 but under Windows 7 you can in the "Power Options" use the "Change what the power buttons do" to set the main power button to put the computer to sleep instead of turning it off.

enter image description here

Brian

Posted 2012-08-19T17:58:40.760

Reputation: 8 439

-2

I've found that the shut down and sleep options are right there in the Windows orb (aka "start button"). If you modify the power settings you can probably also enable/disable hibernation functions too (if it isn't already).

But really. You may have to enable the S1 or S3 power configuration in your BIOS in order for sleep to properly work. There may be other settings too! You may even need to check your power supplies ability since it is possible to actually shut down even though you're actually trying to put the system to sleep. And the reason that might happen is because there might not be enough current on the 5V rail which is necessary to keep the RAM and RAM circuitry alive in a true sleep condition. (Now you know why it's so dangerous to plug/unplug expansion cards or add/remove RAM modules when power cord is still plugged in.)

Otherwise, hibernation and possibly enabling WOL (Wake On LAN) might work? But WOL would require a router capable of handling those "special" packets. Hibernation also doesn't allow a system to wake on a particular event such as if you were scheduling WMC to record a television show or even if you wanted to schedule Windows to defrag itself at 3:00AM. Hibernation is really only good for booting fast. You'll still go through the BIOS POSTing and all, but then Windows will appear to almost instantly turn on since the RAM is essentially reloaded from a huge temporary file on the HDD (this is really more for laptops when you think about it).

Anyway, good luck. I think the reply from "superuser" is more than adequate for your immediate question of what command to use. Although, I might have just created a shortcut and possibly used this for the command: Rundll32.exe Powrprof.dll,SetSuspendState Sleep (Here's a link where I think I saw it: http://answers.microsoft.com/en-us/windows/forum/windows_vista-desktop/is-there-any-way-to-make-a-desktop-shortcut-for/4e57f536-50a8-4942-a84a-290b3dea1ffb )

Anonymous

Posted 2012-08-19T17:58:40.760

Reputation: 42

My computer sleeps just fine. It's just that it's too hard telling it to sleep. The SetSuspendState Sleep suffers from the same problem as the other suggestions: it will prefer hibernation to sleep. (Not my downvote, thanks for your reply.) – Andomar – 2012-08-19T19:34:11.123

He's talking windows 8. There is no "windows orb" any more. – Joel Coehoorn – 2012-08-19T19:37:13.840