2

I often need to quickly put my Windows 10 computer to sleep in my shared office at work, so what is a keyboard shortcut to put the computer to sleep? Ideally, I want a built-in shortcut, or one that can be configured with native Microsoft Windows features without installing any third-party applications.

Virtually the same question has already been asked (What is the hotkey to put my Windows to sleep?), but that poster accepted an answer that involved 3rd-party software, which I would prefer to avoid (less crud on my systems). Moreover, some answers involved a long series of up and down and backwards arrow keys (kind of like a video game cheat code), which is not my idea of a keyboard shortcut, especially when the sequence varies depending on a computer's particular configuration (e.g. works on my desktop with hibernation disabled, but not on my laptop where the hibernation option requires memorizing a different sequence).

Since it seems that Microsoft doesn't offer a built-in shortcut, could someone please perhaps explain how to create one for sleep without 3rd party tools?

Tripartio
  • 610
  • 2
  • 8
  • 20
  • @Ƭᴇcʜιᴇ007, I've revised the question to explain why I'm not quite satisfied by the answers to that question (which I agree is basically the same question). Also, could you please expand your comment to MikeC's answer into a full answer? – Tripartio Jan 23 '17 at 21:23

3 Answers3

2

The following command will immediately send Windows to hibernation, so long as that is enabled (it is recommended against using hibernation for machines with the OS on an SSD).

shutdown -h

Alternatively, here is a post with the same question and more options: How can I put the computer to sleep from Command Prompt/Run menu?

MikeC
  • 139
  • 4
  • 1
    The original question asked for a keyboard shortcut, not a terminal command. – Tripartio Jan 23 '17 at 15:04
  • 3
    @Ochado Make a batch file with that command, and then create a shortcut to the batch file, place it on your desktop and assign it a keyboard shortcut. – Ƭᴇcʜιᴇ007 Jan 23 '17 at 15:13
  • 1
    @Ƭᴇcʜιᴇ007, if you could please give an answer that explains step-by-step how to do that, then I think that's what I'm looking for. – Tripartio Jan 23 '17 at 21:20
1

Using @MikeC answer:

  • create a file named, for example soft-shutdown.bat wherever you want.
  • open this file and paste shutdown -h in it. (right click on the file, and choose Edit, and then paste)
  • right click on the it, and Create Shortcut
  • right click on the shortcut, select properties
  • in the shortcut key field, press the combination you want.

I'm not aware of how to bind a shortcut to run a file, I just know how to bind a shortcut to a shortcut file, which is bounded to a file.

math2001
  • 111
  • 4
1

Create a new shortcut in a safe location: Right-click > New > Shortcut.

For the location of the item enter: %windir%\System32\shutdown.exe -s -t 00

That's the Shutdown program, followed by the Sleep argument, and the Time Zero Seconds argument which means it'll happen right away.

Click Next.

Change the name of the shortcut if you wish and click Finish.

Right-click on the newly created shortcut and click in the Shortcut key: field.

All Shortcut Keys begin with CTRL-ALT, so just tap the SINGLE letter you want the Shortcut Key to end with. For instance, tap "S" and your keyboard shortcut will be CTRL-ALT-S.

Using this shortcut key should now put your computer to sleep right away.

UPDATE: I was wrong on the shutdown arguments

As Ochado pointed out, shutdown -s shuts the computer down, which is entirely NOT what they wanted.

The shutdown command does not actually have an argument to sleep the computer. Hibernate is more of a combination of shutdown and sleep.

To actually sleep the computer using a command which can be put into a shortcut and assigned a keyboard command, you have to disable hibernation, and then use a different set of commands.

First, disable hibernate by running powercfg -hibernate off

Now, create a shortcut as I specify above, but use the command rundll32.exe powrprof.dll,SetSuspendState 0,1,0 instead of the shutdown command previously (erroneously) specified.

Now follow the rest of the steps in the above section to create a keyboard shortcut for this.

music2myear
  • 40,472
  • 44
  • 86
  • 127
  • I tried this, but it shut down my computer immediately. Apparently "-s" means "shutdown", not "sleep": https://technet.microsoft.com/fr-fr/library/bb491003.aspx?f=255&MSPPError=-2147217396 – Tripartio Feb 21 '17 at 09:39
  • My bad. I use the -r a lot myself, I found more info on getting to actual sleep, which is different than hibernate (or shutdown, lol) and is NOT a function of the shutdown command. I'll update my answer. – music2myear Feb 21 '17 at 19:33
  • I successfully followed your instructions to configure the shortcut (it goes to sleep when I double-click the shortcut), but I can't get it to respond to any keyboard shortcut that I set up. I've tried CTRL-ALT-D, which does nothing at all. Then I tried CTRL-ALT-R, T, Y, U, and other random letters, which all do nothing. In fact, your example, CTRL-ALT-S opens System Information. Have you been able to get the keyboard shortcut part to actually work with a specific combination in Windows 10? – Tripartio Feb 22 '17 at 17:03
  • I tested D, R, T, Y, U, and S and they all worked (Using CTRL-ALT-) on my Win10 computer (build 1607) just now. I'd wonder if there are installers may have assigned keyboard shortcuts to their programs, just as a first thing to check. I'm going to see if it makes a difference WHERE the shortcut is placed in the filesystem too. – music2myear Feb 22 '17 at 17:36
  • Ok, I've tested in several locations and the only way it worked was when the shortcut with the keyboard commands assigned existed in the user Desktop. Documents, D drive, C:\Temp all did not work. – music2myear Feb 22 '17 at 17:40