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:"=\"%"

how to schedule sleep on windows 10 How to schedule sleep on Windows 10

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.

how to schedule sleep on windows 10 1 How to schedule sleep on Windows 10

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.

Check Also

fraps download for windows 10 full review 2021 FRAPS Download for Windows 10 (Full Review 2021)

FRAPS Download for Windows 10 (Full Review 2021)

When it comes to recording your screen on Windows 10, the number one software that …

Leave a Reply