Schedule Windows to Sleep and Wake Automatically

There are third-party power management programs that do this, many of which come bundled with laptops. But if you are on a plain vanilla Windows desktop, you may want just to go ahead and do it natively. Here’s how:

  1. Disable hybrid sleep/hibernation. (Optional, but recommended.)
  2. Create a script file (.bat) to put your computer to sleep.
  3. Create a script file (.bat) to wake your computer.
  4. Schedule your computer to sleep and wake at a certain time.

How to Disable Hybrid Sleep/Hibernation in Windows

The first step is to disable hybrid sleep and/or hibernation on your computer. Why would you want to do this? Hibernate is a power-saving feature that saves your machine’s state (including unsaved documents, program states, etc.) onto your primary hard disk instead of onto the RAM (as sleep does.) The tradeoff is slower resume time but less power draw. This is important for laptops with batteries, but not so much for desktops. Hybrid sleep does both—it saves open documents and application states into the memory and the hard disk. This is so you won’t lose anything in case of a power outage. But the real issue is that sometimes, hybrid sleep/hibernation can interfere with an automated wake script, depending on your configuration. In my case, waking from hibernation from a script only half worked—the computer would turn on, the fans would spin, and I’d get stuck on the “Resuming Windows” screen forever. If you have similar problems, you might just want to disable hibernation/hybrid sleep altogether. Here’s how: Open a command prompt as an administrator. To do this in Windows 7, click the Start button, type Cmd and then right-click cmd.exe and choose Run as administrator.

Type powercfg -h off and press Enter.

If the command was successful, then you’ll get no error messages. If you get the error message: “You do not have permission to enable or disable the Hibernate feature,” then re-read the previous step about running cmd.exe as an administrator. Now, like a bear addicted to espresso, your computer will no longer hibernate. It’ll sleep, but it won’t hibernate. Mission accomplished. For more information on Hibernation vs. Sleep, read this write-up that Austin did on the subject: Understanding Your PC And Devices, Sleep VS. Hibernate [groovyTips]

How to Create a Batch (.bat) File to Put Your Computer to Sleep

The way we’ll put your computer to sleep is by running a script (.bat) that will initiate the sleep command. By using a batch file, you can add other parameters and commands to it later without rejiggering your Windows Task Scheduler task. To create a sleep batch file, open up Notepad and type the following: Rundll32.exe Powrprof.dll,SetSuspendState Sleep

Click File –> Save As, Under Save as type, choose All files . and give your file a name like sleep.bat (or something else with a .bat extension.) Got it? If not, you can just download the sleep and wake batch files I already created by clicking here.

How to Create a Batch (.bat) File to Wake Your Computer

There isn’t a command-line command to wake your computer. That’s because if you are in a position to be running commands, then your computer is, of course, already awake. But what we can do is create a batch file with something arbitrary in it and then tell Windows Task Scheduler that it can wake the computer to run it. So, go ahead and make a batch file that does something like “echo Hello!” and then save it as wake.bat.

Again, you can also just download our sleep/wake batch files here.

How to Schedule Your Computer to Sleep and Wake at a Certain Times

Now that we have batch files to sleep and wake our computer, we need to tell Windows when to run them. Run Task Scheduler. The fastest way to get to it is by clicking the Start button and typing Task Scheduler.

Click Action and then Create Task; in the General tab, give it a name like “Sleep.”

In the Triggers tab, click New.  Set the task up to begin “On a schedule,” and choose daily, and plug in the time when you want it to run. Click OK.

Your trigger will be enabled.

Next, click the Actions tab and click New. Set the action to “Start a program” and browse to your sleep.bat script. Click OK.

Here’s your action:

If you want to prevent the computer from sleeping if programs are running or someone is using the computer, then use the following settings in the Conditions tab:

Click OK. You’re done with this part. If you want to test it out, you can add a new trigger that sets it in motion 1 minute from now.

Next, let’s make a Wake task. Click Action and Create Task, and name it Wake in the general tab.

Then, create a daily trigger with the time you want to wake your computer.

Next, go to the Actions tab and make an action to run your wake.bat script.

Now, go to the Conditions tab. Here, make sure that the “Wake the computer to run this task” option is checked.

Click OK. Now, your computer will wake and sleep at the scheduled times. Enjoy!

  1. you don’t need a bat file, AT ALL 2) You just set the Task Scheduler to run shutdown.exe with the appropriate option … no batch (.bat file needed). I’m not sure why people constantly write batch files. now if you want to do MORE than just the shutdown command (a series of commands before the final shutdown.exe, then this would make more sense)…. Otherwise just reference shutdown.exe in the task scheduler with the slash commands… .. that’s the way I do it… my BIOS wakes the my PC an hour before I wake, be if from hibernation or full shut. This gives Superfetch PLENTY of time to cache my hard drives in either case. Then TaskScheduler shuts my computer down if I have not used it for a certain time period (which is outside the normal power save profile settings). This is if I go away, out of town, etc, and forget to power down my PC The above article is very nicely done. Thanks for sharing. Can you help me for this ? Any suggestions. shutdown -s -t 14400 and make task scheduler run it on startup (note: the time is expressed in seconds, hence the 14400 which equals to 4 hours) Has anyone managed to make their PC wakeup in the morning using task scheduler in Windows 10? Thank you. Anyone know how to get around this without using pstools? I BTW have set Power Options setting shutoffs to “Never” (for both sleep & hibernate). If I understand this correctly, it is actually the BIOS that does the wake-up as Windows wouldn’t be active, especially if in hibernate mode. If so, I’d also like to know exactly how that works – does Task Scheduler store the wake-up time(s) in the bios and the bios battery keeps some sort of logic going in the bios to perform the wake-up function?? I’ve also noted BTW that, if in hibernation, the computer AC power can also be turned off and the machine will still wake at the scheduled time as long the AC is restored before that time. Above method to schedule window 10 on SLEEP is not working on my PC, is there another solution to schedule sleep? thanks. thanks. I had the same problem, too. It seems using the sleep-command above disable the RTC which is necessary for the Scheduler (maybe it forces the Computer to go into hibernation even when it’s diabled or something like that) My solution was using the PSTools from Microsoft: https://technet.microsoft.com/sysinternals/pstools.aspx the command for suspend is: …/psshutdown.exe -d I need to turn off the monitor’s screen at 1 AM and turn on at 5:30 AM and then login to gmail. I got a script to open chrome and login to gmail. However finding it hard to get the info for monitors screen scheduled turn off and on. I hope you could help me with this or atleast guide me how to do this. Thank you Sleep.bat works fine. Wake.bat does NOT seem to be working, as I have to use the keyboard to wake my PC. Any ideas? Task scheduler in windows 10 used to wake my computer every 1. For the last few weeks, I noticed that my computer stopped waking up, removing drivers, updating drivers and enabling all features to get this to work again has failed. I spend about 1 or 2 hours per day trying to get task scheduler to work without any luck. This is driving me crazy, I tied out software molliesoft com / winsleep and I can get the computer to turn on perfectly, BTW great software. Why do we need to use a 3rd party software to get this to work, did Microsoft break the task scheduler. Thank you – Marvin Hymowech MollieSoft General tab –> Security options section –> ‘When running the task, use the following user account –> click ‘Change User or Group…’ –> in the ‘Enter the object name to select’ field, type SYSTEM, then click ‘Check Names’ –> click OK What worked was: rundll32.exe powrprof.dll,SetSuspendState 0,1,0 Any idea on how I can force the display to come up as well? working on win 10 HP all-in-one Comment

Δ