Schedule Windows to Sleep and Wake Automatically

Too lazy to walk into your office and push the ON button every morning? Me too. That’s why I set up Windows Task Scheduler so my computer automatically sleeps and wakes at a certain time. You can, too, with this tutorial.

Brian has been doing an awesome job covering several neat things you can do with Windows Task Scheduler. One more: scheduling Windows to wake or sleep automatically at a particular time. Why would you want to do this? I don’t know about you, but for me, I was using my desktop Windows 7 PC as a file server for some time. Rather than sending wake-on-LAN packets every time I wanted to access a file on my Windows file server, I decided to leave the thing on from 10 AM to 10 PM every day. This was a compromise between waking up on demand and leaving my computer on 24/7 (sorry, environment.)

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.

wake and sleep automation - cmd.exe elevated

Type powercfg -h off and press Enter.

disable hibernation / hybrid sleep with powercfg

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

auto sleep script for windows 7

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.

auto wake script for windows 7

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.

task scheduler - sleep wake schedule

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

create a sleep task in windows task automator

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.

set sleep time in windows task scheduler

Your trigger will be enabled.

creating a daily sleep schedule in task scheduler

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

start a sleep script with windows task scheduler

Here’s your action:

windows task scheduler with sleep.bat

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:

prevent computer from automatically sleeping in task scheduler

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.

sleep and wake task scheduler

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

automaticaly wake in task scheduler

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

wake computer at a certain time in task scheduler

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

wake.bat in windows task scheduler

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

wake the computer to run this task

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



  1. tiz8x

    So I Want : wake up at 20:00 then sleep at 03:00 a.m (just for seeding tor)
    Its ok if I do like Your tips
    Sr For My english

  2. chetan

    I also want my PC to remain off(sleep) during weekends.
    Is it settable…?

    • Malachi

      Yes. Instead of “Daily”, pick “Weekly” and select the days you want it to run (mo-fr).

  3. Dave

    WAY more complex than it needs to be:

    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

    • Jake

      The title of the article is “Schedule Windows to Sleep and Wake Automatically”. Not Shutdown and wake.

    • Hendra Winata

      The sleep function is for Other purpose for Example we use the PC for LED display In a remote or out of reach location when if you schedule to shutdown and turn the PC back ON, it won’t directly open up the led program neither play the specific advertisement video. The sleep function Helps a lot in term of Power saving and back ON state to do its supposely doing work without having to Run 24/7/365

    • Leonard

      One reason is that shutdown.exe is randomly missing from windows installs. Another is that shutdown.exe is commonly a hackware entry point so sometimes its deleted as a protection mechanism. And the final prize winner is that Microsoft has no idea why anyone would want to sleep their computer because electricity is free.

    • Alex

      There is no sleep option in shutdown.exe.

  4. Labeeb Ahmad

    Sir, Is it possible to do this method to put the computer to sleep if a certain battery percentage level reaches ON IDLE COMPUTER, different from low or critical battery action provided by windows 7 or 8.1. Windows does give option to put to sleep after specific time but not specific battery percentage level.

    • Malachi

      Yes, however, sleep will still use the battery. That’s why the computer will go to hybernation instead… which is recommended then anyway.

  5. Damon Farris

    Thanks for this information. I have been trying to get my computer to wake up when my satellite Broadband downloads do not count against the monthly allocation (10 GB)
    Thanks again.

  6. Ryan S. White (sunsetquest)

    Another way that also might work:
    1) Open the command prompt
    2) and type:
    timeout 3600 /NOBREAK & Rundll32.exe Powrprof.dll,SetSuspendState Sleep

    • Ryan S. White (sunsetquest)

      Not sure why I posted this – I think I meant to reply on another site…. my comment only puts the computer to sleep after X seconds.

      The above article is very nicely done. Thanks for sharing.

    • Zeust

      thanks for this … been looking a long time a way to turn my pc at specific time and finally I can do it … thanks

  7. Hatsjer

    Thank you so much for this! I love to listen to music when falling asleep. Now I don’t need to worry about my laptop being on all night long. :)

  8. gt

    So if the computer’s power settings are configured so it will Never go to sleep, is the sleep .bat overwrite that condition?Which is superior, the bat file or the power setting…

  9. Berty

    I’m really struggling with the settings. I’m trying to get my PC to wake up at 1200, and sleep at 1400, wake up at 1800 and sleep at 2000, wake up at 0000 and sleep at 0200. I only want it to sleep if it has remained idle for a full hour. What I’m getting is the PC waking up on time but then shutting down minutes later because the sleep task from the previous time has kicked in. Any ideas please?

  10. Fred

    so how can the spell be reverse[powercfg -h off]…….TO TURN IT BACK ON

    • Anonymous

      Fred, to reverse this command, go into command prompt as an administrator, and type the following: [powercfg -h on] .
      Instead of “off” at the end of the command, replace it with on. If you turn it back on, you will revert everything the guide says to do.

  11. Georgi

    Hello i want to do something slight different (with some additions), but I don’t know how to.
    The case is as follows:
    1) I want my computer to go to sleep at 23:59:59 every night.
    2) Because sometimes I am working till very late i want the computer to prompt me with confirmation to got o sleep like (I will go to sleep do you allow me?) with Yes/ No buttons.
    3) If I press Yes it will go to sleep
    4) If I press No it will suspend the task and ask me again in 1 hour
    5) If I don’t press anything for 30s it will go to sleep automatically (like I if I pressed Yes)

    Can you help me for this ?

    • Derek

      Conditions just set “idle for X minutes” to what you want and then retry to however long you might be working (i.e. only sleep if computer is idle for 10 minutes, keep trying to sleep for up to 3 hours past 23:59:59)

  12. lily

    is there a way to schedule a task to shutdown after four hours of logon? in the trigger tab of the scheduler there is to set a date, but im looking for a way to shutdown after four hours of use everyday or everytime it is being used.

    Any suggestions.

    • goodmr.mrgood

      you could make a batch file with the command:

      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)

  13. dashing501

    Hi…Can you please tell me how to set uo above settings for windows 10. My computer was working fine with your directions but since I updated to windows 10, it’s not working. Computer will go sleep as scheduled but it won’t wake up. But wake up task scheduler works fine if I put computer to sleep through start (windows sign on bottom left) button. I am not if it has to do anything with sleep.bat puting computer into hibernation. Any help greatly appreciated. Thanks

    • Chris

      I am having this issue too ^^^ hopefully there is an answer??

  14. Bhup

    I have a similar problem with my Win10 Pro pc too. I have used task scheduler to make my PC go to sleep (not hibernate) at night, which works fine. But I am trying to get my PC to wake itself in the morning, but no luck here. I have enabled wake timers in the Windows Power Options, and selected “wake this computer” in the conditions tab in task scheduler.

    Has anyone managed to make their PC wakeup in the morning using task scheduler in Windows 10? Thank you.

    • Matt

      Win 10 is ruining the Wake-UP.

      Anyone know how to get around this without using pstools?

  15. Malachi

    Yes you can have it wake up from sleep, however it will go to sleep automatically after a minute or less if you’re not logged in… I have something in place that will log in and then lock it so that programs still run, however it goes back to sleep again… Very annoying ‘feature’ since Windows 8 ( so yes, 10 has the same thing).

    • NoSmoke

      I have been experimenting (Win 7 system, desktop) with timed wake up and have found I can get a pretty reliable wake from hibernate i.e. computer wakes and stays on, but wake from sleep mode results in a wake but the computer then shuts off (goes back to sleep mode) about 1 min 30 seconds later for some reason. Only difference I have noted is that wake from hibernate turns on the monitor while wake from sleep does not – don’t know if that is relevant at all.

      I BTW have set Power Options setting shutoffs to “Never” (for both sleep & hibernate).

      • Malachi

        Interesting… that you have this with Win 7, because I had win 7 before, but didn’t have the issue until I had a win 8 computer. Which would mean that there would be a way around it (since I had it in 7)… I just don’t know how. Thanks for the tip for hibernation though..

        • NoSmoke

          No prob. Would be interesting to know why wake from sleep goes back to sleep – bug in Windows?

          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.

  16. Sohail


    Above method to schedule window 10 on SLEEP is not working on my PC, is there another solution to schedule sleep?


    • Malachi

      What part isn’t working? To run something at a certain time when the computer is asleep?

      • Malachi

        Sorry, forgot to mention: I am using windows 10 and my computer wakes up every morning and runs its stuff (… and then goes back to sleep.. issue with win8 and 10 unfortunately..)

        • Sohail

          Exactly! this method for sleep schedule not working on window 10. Any solution to schedule for sleep?


          • Malachi

            Do you want it to wake up at a certain time, or to go to sleep at a certain time?

  17. Dashing501

    Actually I just downloaded auto wakeup and shut down software from There is a 30 day free trial. I just couldn’t handle the frustration and bought the software. It works like charm on Windows 10 too.

  18. Dashing501

    Sorry it’s actually

  19. Chris

    Doesn’t wake up on Windows 10. Scheduled sleep works fine though. I have wake on lan and all that active too.

    • Ditophon


      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:

      the command for suspend is:

      …/psshutdown.exe -d

      • Elias

        Thank you Ditophon!
        psshutdown.exe is the solution for me!

        • Nguyen Nhat Minh

          Can you please explain further? what exactly I have to type in the batchfile??

  20. PBC Ho

    I had a problem and want to share with you all the solution. In general tab of the wake task , I selected “Run whether user are log on or log off” and it does not work properly. The computer is waked up but the printing task I assigned is not executed. I have to change to “run only when user is logged on” and it works !

  21. Sandy Rachmad

    I got this message after I click ok in task scheduler.
    User_Feed_Synchronization-{57EEBECF-6D39-4AA7-B7C6-EBDAF4A1A9A}: The task object version is either unsupported or invalid.”
    What should I do?

  22. seanivo

    You can use WinSleep to sleep the computer whenever it is not busy, and wake at the end of a scheduled period.

  23. Syed

    Hello Sir,

    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

  24. Prakash

    Highly useful. Great work Mate.

  25. diMitko

    Can someone explain me in detail how to wake up Win 10, because mine doesn’t want to do so.

  26. Matt

    Using Win 10, Dell all-in-one touchscreen PC.

    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?

    • Tamir

      Same here, the task is performed but the display is still in sleep mode..

    • Aaron

      I don’t use the bat files but sleep mode works but it looks like that’s also what’s preventing the computer from coming back from sleep. I had my pc set to sleep at 8am and wake the PC at 10pm. The PC always goes to sleep but it wasn’t waking up from sleep.
      When I manually put the PC to sleep, the wake function works.

  27. robcarbonell

    Hello everyone.

    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

    • support

      Thank you for your kind words about WinSleep! My view is that omitted Microsoft functionality is not a problem, but an opportunity for us 3rd party developers…LOL. Actually, WinSleep does lots more than just turn the computer on and off. It shows a complete graphical history of when it was awake/asleep, and the new Sleep Journal shows you WHY your computer woke up.

      – Marvin Hymowech

  28. Giorgio

    Simple And Perfect!!!
    Thanks a lot!

  29. Ray

    Thanks for sharing excellent tip.

  30. KAT

    The thing that worked for me…To wake laptop from sleep, I had to use the ‘SYSTEM’ account, not my own user account, to run the ‘How to Schedule Your Computer to Sleep and Wake at a Certain Times’ batch method process on this page..

    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

  31. happyone

    The argument Rundll32.exe Powrprof.dll,SetSuspendState Sleep did NOT work for me.

    What worked was: rundll32.exe powrprof.dll,SetSuspendState 0,1,0

  32. Tushar

    Thanks a lot, this worked for me.

  33. Tamir

    Hi every thing is working great, but when I use wake up the task is performed with a locked screen meaning the display(monitor) does not come up.

    Any idea on how I can force the display to come up as well?

    working on win 10 HP all-in-one

  34. Béla Balogh

    Thanks for this simple method! It works great in combination with a remote app and work! (Especially when you need to have a docker in order to run a program like business center and your laptop can’t run the docker app, so you need your desktop PC on even when working remotely.

Leave a Reply

Your email address will not be published. Required fields are marked *


To Top