Windows hibernate and restart

How to hibernate Windows from command line

We can hibernate a Windows computer from command prompt using shutdown command. Shutdown command has various switches for different operations like shutdown, reboot, hibernate, log off etc. The command for hibernating windows computer is given below.

This works on all Windows versions – XP, Vista, Windows 7, Server 2003 and Server 2008.

Shutdown can be used in a batch script file also. Once the command is triggered, we can’t abort the hibernation operation.

Related Posts:

Not true for Windows XP!

Can every user run this command? I am getting ‘access denied’ error.

if access denied then try to open CMD as Adminstartor
start > search for cmd > right click on Command Prompt > Run As Administrator
and try to type the command again 😉

The command [shutdown /h] did not work on my XP as well. However the command
[%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState] works just fine (as of now [10/27/2016]). I login as the admin all the time on my home PC. Thanks!

Cool it’s working on windows 10

The problem is not the code you should change some settings to allow this work.i have done it before so I don’t really remember what the setting was just Google it good luck.

It also works on windows 10.

can a timer be put? like when we do shutdown -s -t xxx
doing shutdown -h -t is not working. any way to put a timer?

How to disable and re-enable hibernation on a computer that is running Windows

This article describes how to disable and then re-enable hibernation on a computer that is running Windows.

Original product version: В Windows Server 2019, Windows 10 — all editions, Windows Server 2016, Windows 7 Service Pack 1, Windows Server 2012 R2, Windows Server 2008 R2 Service Pack 1
Original KB number: В 920730

You may lose data if you make hibernation unavailable and a power loss occurs while the hybrid sleep setting is turned on. When you make hibernation unavailable, hybrid sleep does not work.

How to make hibernation unavailable

  1. Press the Windows button on the keyboard to open Start menu or Start screen.
  2. Search for cmd. In the search results list, right-click Command Prompt, and then select Run as Administrator.
  3. When you are prompted by User Account Control, select Continue.
  4. At the command prompt, type powercfg.exe /hibernate off , and then press Enter.
  5. Type exit, and then press Enter to close the Command Prompt window.

How to make hibernation available

  1. Press the Windows button on the keyboard to open Start menu or Start screen.
  2. Search for cmd. In the search results list, right-click Command Prompt, and then select Run as Administrator.
  3. When you are prompted by User Account Control, select Continue.
  4. At the command prompt, type powercfg.exe /hibernate on , and then press Enter.
  5. Type exit, and then press Enter to close the Command Prompt window.

More information

The Hiberfil.sys hidden system file is located in the root folder of the drive where the operating system is installed. The Windows Kernel Power Manager reserves this file when you install Windows. The size of this file is approximately equal to how much random access memory (RAM) is installed on the computer.

The computer uses the Hiberfil.sys file to store a copy of the system memory on the hard disk when the hybrid sleep setting is turned on. If this file is not present, the computer cannot hibernate.

Читайте также:  Форматировать usb для linux

Reference

To add the Hibernate option to Start menu, see the Hibernate section of Shut down, sleep, or hibernate your PC.

Add Hibernate option to the Start Menu in Windows 10 [QUICK METHOD]

If you want to save as much power as you can when using your computer you might want to consider using the Hibernate option. This option isn’t enabled by default on Windows 10 but that doesn’t mean that there’s no way to add it to the Start Menu.

Most desktop computers come with Sleep option enabled by default. Using the sleep option you can turn off most of your computer hardware and store your current information on your RAM.

While using Sleep mode, your computer will still use some power although a lot less. So it’s good to use Sleep option if you’re going to be away from your computer for short period of time.

One advantage of sleep mode is that it “wakes up” from Sleep mode in just a matter of seconds, so you can easily continue where you left off.

If your PC won’t exit Sleep Mode, check out this nifty guide to solve the problem. On the other hand, if you’re having trouble keeping your PC in sleep mode, then we recommend you to take a look at this article to find a solution.

Steps to add Hibernate option in Windows 10 start menu

As for the Hibernate option it works on a similar way, but it stores your open documents and running applications on your hard drive and shuts down your computer.

In a Hibernate mode, your computer uses zero electrical power, so it’s good to use this option if you’re going to be away for a while and you want to continue where you left off when you get back.

Only downside of Hibernation mode is that it takes a bit more to start compared to Sleep mode. Let’s see how to enable Hibernation mode on Windows 10:

  1. Open Control Panel and navigate to Hardware and Sound > Power Options.
  2. Click Choose what the power buttons do.
  3. Next click the Change Settings that are currently unavailable link. This will allow you to change shutdown options.
  4. Check the Hibernate (Show in Power menu).
  5. Click on Save changes and that’s it.

If you can’t find your Power Plans, get them back by following the easy steps in this article.

Now you should have Hibernate option available in the Start Menu. If you have any comments, or questions, just reach for the comments below.

Unfortunately, various technical issues may occur after enabling the Hibernation mode on Windows 10. For example, your computer may fail to enter hibernation. In other cases, your computer may take too much time to wake up from hibernation.

In case you encounter any of these issues, you can use the troubleshooting guides listed below. Follow the instructions available in the respective guides and you should be able to fix the problem in just a few minutes:

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.

Before 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

Читайте также:  Lenovo z570 bluetooth driver windows 10

Create Shutdown Shortcut in Windows 10

  1. Right click the Desktop and select New — Shortcut.
  2. In the shortcut target box, type or copy-paste the following command:

See the following screenshot:

  • Set the desired icon and name for your shortcut.
  • 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:

    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.
    2. In the shortcut target box, type or copy-paste the following command:

    See the following screenshot:

  • Set the desired icon and name for your shortcut.
  • Sleep Shortcut for Windows 10
    The command to put the computer to sleep is as follows:

    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:

    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.
    2. In the shortcut target box, type or copy-paste the following command:

    Correct the file path according to your preferences.

  • Set the desired icon and name for your 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:

    It 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.

    Here are additional articles you might be interested in:

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

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

    Share this post

    About Sergey Tkachenko

    Sergey Tkachenko is a software developer from Russia 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.

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

    Is it possible too to get a specific drive in hibernate? e.g. drive D: ?

    A drive for what? For the hiberfil.sys file?

    The .bat file puts my computer into hibernation….what now.

    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.

    I have the same problem

    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 🙂

    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.

    For those who have same problem.
    powercfg -hibernate off should be run as administrator.

    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?

    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.

    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 ?

    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!

    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.

    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.

    did you save the notepad file as ‘sleep.cmd’ in stead of ‘sleep.txt’?

    thanx, works for me!
    wether it’s sleep or hibernate I can’t seeet (but that’s fine for me)

    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.

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

    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?

    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

    @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.

    Читайте также:  Add to your path windows
    Оцените статью