Advertisement

Create Shutdown, Restart, Hibernate and Sleep Shortcuts in Windows 10

In Windows 10, you can use various methods to shutdown, restart, hibernate or sleep the operating system. However, if you need to create a shortcut to perform one of these actions directly, the operating system does not provide you such an option. You need to create such shortcuts manually, using a special set of commands. Here is how it can be done.

Windows 10 power shortcut bannerBefore you continue, you might be interested in knowing that it is possible to create a shortcut for the good old classic Shut Down Windows dialog. We showed you how it can be done here:
How to create a shortcut to the Shut Down Windows dialog in Windows 10

Create Shutdown Shortcut in Windows 10

  1. Right click the Desktop and select New - Shortcut.Windows 10 new - shortcut
  2. In the shortcut target box, type or copy-paste the following command:
    shutdown /s /t 0

    See the following screenshot:Windows 10 shutdown shortcut

  3. Set the desired icon and name for your shortcut.Windows 10 shutdown shortcut nameWindows 10 shutdown shortcut icon

By default, the shutdown /s /t 0 command will perform a full shutdown. This means that the fast startup feature will not be used the next time you start your computer. If you are using Fast Startup, you should modify the shutdown command and add the /hybrid switch as follows:

Advertisеment

shutdown /s /hybrid /t 0

Windows 10 shutdown shortcut hybrid

Create Restart Shortcut in Windows 10
To create a shortcut to restart Windows 10, use the shutdown /r /t 0 command as follows:

  1. Right click the Desktop and select New - Shortcut.Windows 10 new - shortcut
  2. In the shortcut target box, type or copy-paste the following command:
    shutdown /r /t 0

    See the following screenshot:Windows 10 restart shortcut

  3. Set the desired icon and name for your shortcut.Windows 10 restart shortcut nameWindows 10 restart shortcut icon

Sleep Shortcut for Windows 10
The command to put the computer to sleep is as follows:

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

However, if you have hibernation enabled, which is on by default on most computers, the command will put your PC into hibernation instead. I explained this in detail here: How to sleep Windows 10 from the command line.
So, you can create a batch file "sleep.cmd" with the following contents:

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

Windows 10 sleep batch

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 to sleep.

Let's assume that you saved the batch file to the folder c:\apps. Then you create a shortcut to put Windows 10 to sleep this way:

  1. Right click the Desktop and select New - Shortcut.Windows 10 new - shortcut
  2. In the shortcut target box, type or copy-paste the following command:
    c:\apps\sleep.cmd

    Correct the file path according to your preferences.

  3. Set the desired icon and name for your shortcut.Windows 10 sleep shortcut

Hibernate Shortcut for Windows 10
As mentioned above, when hibernation is enabled, the same command hibernates your PC so create the following batch file:

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

Windows 10 hibernate batchIt will enable hibernation if it was disabled and then hibernate your Windows 10 PC.
Save it, for example, as c:\apps\hibernation.cmd
Then create a shortcut to this file.Windows 10 hibernate shortcut

Here are additional articles you might be interested in:

That's it. If you have a question or suggestions, you are welcome to comment.

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.

23 thoughts on “Create Shutdown, Restart, Hibernate and Sleep Shortcuts in Windows 10”

  1. Hello:

    I have hibernation enabled. I followed the instructions to create a sleep button when hibernation is enabled.

    When I click on the button my computer hibernates.

      1. I have the same problem. It helped a lot:
        I create plik .bat (not .cmd):

        powercfg -h off & start /min “” C:\WINDOWS\System32\rundll32.exe PowrProf.dll,SetSuspendState 0,1,0 & ping -n 4 127.0.0.1 > nul & powercfg -h on

        It’s not professional, but it works :)

        1. No matter what command I use, no matter what variation, every sleep command causes my W10 computer to hibernate, even though I have hibernation disabled.

  2. Shutdown and restart shortcuts FORCE windows to shutdown, therefore all running apps don’t get time to save their data properly, for eg: Utorrent is force closed therefore when i start the pc, it re-calculate all the torrents even completed torrents too, which is a bit nuisance.

    So is there any shirtcut available to normally shutdown/restart/logg off/lock windows pc?

    1. Hello.
      The shutdown is forced when you specify the /f switch. Ensure that you have no /f switch added to the shutdown command.
      Also, you may try to change the /t argument value. Let’s say, change it to /t 5.

  3. Sleep command does nothing on my w10 .
    tried with a cmd file also.
    rundll32.exe powrprof.dll,SetSuspendState 0,1,0
    Does nothing . Any suggestions ?

  4. Is there any way possible to add a confirmation before shutdown?
    Because, I have pinned your shortcut in the task-bar and sometimes it shuts down directly.
    It would be nice if get a chance to press enter key after pressing the shortcut to proceed with the shutdown.
    Kindly say if there is any solution..
    thanks!

    1. Well, the only solution to pin a batch file instead and use a confirmation there.
      Or, you can pin a VBscript file with a message box.
      Please let me know if you need assistance with these ideas.

  5. i followed this step by step for creating the one click sleep button, but all it does is open the notepad that the code in on. It doesn’t actually run the program. what did i do wrong????

  6. What worked for me and I find it important is that you need to run the .bat or .cmd (both extension works) as an Administrator!

    However this process can be even more stripped down.
    Run a “CMD” as Administrator and issue this command: powercfg -h off
    This will turn off hibernation all together. Reboot the box and go into power settings and verify that the hibernation option is totally gone (it was gone in my Windows 10 Power Setting GUI menu).

    With Hibernation not even being an option, the .cmd file can simply have one line:
    rundll32.exe powrprof.dll,SetSuspendState 0,1,0

    And you don’t even need to run this as an Administrator for it to put it into sleep mode.
    Now my keyboard tap will wake it up (before it was going into Hibernation mode).

    Also, as an Administrator, you can simply run the command to turn off hibernation (in Windows 10 for me) and it remains “offline” after future reboots.

    With that in mind, your future command attempts to sleep works without having to run as Administrator.

    1. After disabling hibernation in admin mode, rundll32.exe powrprof.dll,SetSuspendState 0,1,0 command doesn’t work at all. No response

  7. Sleep (,SetSuspendState 0,1,0) and Hibernate (,SetSuspendState Hibernate) commands issued on Windows 10 (1909 18363.836) put the system into states from which Task Scheduler tasks with “Wake the computer to run this task” checked DO NOT WAKE the system on schedule.

    Sleep and Hibernate states initiated from Start Menu, Power Options Sleep/Hibernate settings and Power Button all put the system into states from which Task Scheduled tasks with “Wake the computer to run this task” checked DO WAKE the system on schedule.

    On Windows 7 Sleep and Hibernate states initiated by commands have no negative effect on task waking and tasks DO WAKE the system on schedule.

    I’m guessing that SetSuspendState under Windows 10 has an added argument. Any ideas?

  8. I have another sleep batch file.
    @echo off
    powershell (Add-Type ‘[DllImport(\”user32.dll\”)]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);’ -Name a -Pas)::SendMessage(-1,0×0112,0xF170,2)
    rundll32.exe user32.dll, LockWorkStation
    cls

    1. @echo off
      powershell (Add-Type ‘[DllImport(\”user32.dll\”)]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);’ -Name a -Pas)::SendMessage(-1,0×0112,0xF170,2)
      rundll32.exe user32.dll, LockWorkStation
      cls
      This above script just lock down the system, it doesn’t make it sleep.

  9. Maybe this in a regular shortcut –

    Powercfg -h off & Rundll32.exe powrprof.dll,SetSuspendState 0,1,0

    Be Shure to mark a v in it for it so it runs as administrator.
    My it runs also without it.

Leave a Reply

Your email address will not be published.

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