1. Home
  2. Windows Tips
  3. Schedule sleep on windows 10

How to schedule sleep on Windows 10

Scheduling a shut down on Windows 10 is simple but you’ll be surprised to learn that it is just as difficult to schedule sleep on Windows 10. The command-line argument that claims to sleep a system actually hibernates it. The common method around this is to first disable/turn off hibernate on Windows 10, and then run the sleep command with time parameters. For a simpler solution, one that end users can modify per their own needs, we’re going to use a batch script and a scheduled task.

Sleep system script

This script has been written by SuperUser user AveYo. Open Notepad and paste the following in it. Save the file with the BAT file extension. If you want, you can test it out by running just the script. It should put your system to sleep.

@echo off &mode 32,2 &color cf &title Power Sleep
set "s1=$m='[DllImport ("Powrprof.dll", SetLastError = true)]"
set "s2=static extern bool SetSuspendState(bool hibernate, bool forceCritical, bool disableWakeEvent);"
set "s3=public static void PowerSleep(){ SetSuspendState(false, false, false); }';"
set "s4=add-type -name Import -member $m -namespace Dll; [Dll.Import]::PowerSleep();"
set "ps_powersleep=%s1%%s2%%s3%%s4%"
call powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -Command "%ps_powersleep:"=\"%"

Schedule sleep

With a reliable way to sleep your system now available, you need a simple way to schedule when it will be put to sleep. Task Scheduler gives you a very simple GUI for scheduling when a script (or app) runs so we’re going to use it.

Open Task Scheduler and create a new task. Name it something that will tell you it is for scheduling sleep. Go to the Triggers tab and add a new trigger. The trigger should be set to ‘On a schedule’. You’ll find plenty of options for scheduling i.e., how frequently the task should be run so use it to schedule sleep as flexibly as you need to. Once you’ve added the trigger, go to the Actions tab.

Add a new action, and set it to run the sleep script that you created earlier, and you’re done.

The task will be enabled automatically and at the given time, it will run the script that will sleep your system.

Sleep will lock your system and put it in a low power mode. Your apps will remain open and you will still be signed in. You will have to wake the system by pressing the power or sleep button on your laptop/PC, and then unlocking it like you normally do. Since no apps will be closed, you don’t have to worry about losing work.


  1. Hey Fatima, thanks for your post. Unfortunately it’s not working for me. It is strange, because if I run the bat directly it sends the computer to sleep, if I run through scheduler it sleeps it, but immediately turns it back on.

    Do you know what could be happening?

  2. Great tip if it works wit Windows 10. Initially when tested it began to shut down and sat running minimal power and needed to be shut down. Do you have a wake up script to go with it.?

  3. No where in this explanation or the video does it say where the bat file is to be saved. I figured out where to save it by zooming into the video. Thanks for the tip.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.