Here’s the scene:
It’s 2:00am. Your room is a dark abyss except for a lurid blue glow casting a cold color on your walls. You’re trying to finish up a project but your battle against sleep is becoming abortive.
Eventually you succumb to sleep; your chin hits the top of your sternum, a viscous river of drool leads out the crack of your mouth and you’re snoring like an English Bulldog. The soporific effect of the ticking clock on your desk swept you into the sweet oblivion of sleep and before you knew it – you conked out.
But you never shut down your PC! In fact while you’re snoozing your PC was still on wasting energy.
Today I’m going to show you how to configure your PC to automatically go to sleep at a specific time. We’ll also make it smart so that if you set your PC to sleep at 2am, but you happen to be working at that time, it won’t sleep. It’ll only sleep if your computer is idle at the time you specified.
Give your PC some sleep
Assuming your computer isn’t having issues taking a nap, in Windows 8 and 8.1 you can press the Windows Key + xus to give your languishing PC a respite from the day. Or you can click your desktop background wallpaper to give it focus and then press Alt + f4 and select Sleep from the drop down menu.
But here’s a better idea. We’re going to use the Windows Task Scheduler to schedule bedtime for your PC.
Open the Task Scheduler
Press the Windows Key + w and enter the word: schedule. It should autocomplete to “schedule tasks”
The Task Scheduler lets you launch programs or scripts at specific times or when specific conditions are met. It’s a very powerful tool but today I’m just going to show you how to schedule your PC to take a nap when you’re not using it.
Click Create Task… in the right Pane under Actions.
Tour your tabs
There are five tabs here:
We need to adjust a setting in each of these tabs but don’t worry – I’ll walk you through the entire process from start to finish.
First, in the General Tab we need to name our task.
Give it a name and description and make sure Run with highest privileges is checked near the bottom of the window.
Great, now let’s toy with triggers and configure the catalyst for the event. Click the Triggers tab and then hit up the New… button.
Change the recurrence to Daily and set your start time. I’m setting mine to 2am but you can pick anything you want.
Great we’re done here. On to the Actions tab.
This is the tab that actually calls the program that’s responsible for putting your machine to sleep.
Paste the following string into the Program/script box:
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
We’re basically stuffing the program executable and arguments into one verbose string and letting Windows break it out for us.
Click Yes on the confirmation box and march onward to the Conditions tab.
The Conditions tab is consonant with the Actions tab. The two work together and allow you to refine the criteria for kicking off a task.
So when exactly do we start the task? We scheduled it for everyday at 2am but that’s still too broad.
Place a checkbox in Start the task only if the computer is idle for and set your value to either 1, 5, 10, 15, 30 minutes or an hour. I’ll set mine to 15 minutes.
You may have noticed there’s also a Wait for idle for value there (currently set to 1 hour in the screenshot above).
So here’s a pop quiz:
What’s the difference between Start the task only if the computer is idle for and Wait for idle for?
This question has confounded the greatest minds of our day and I hope it confused you too so I’m not the only one feeling stupid here.
This is how it works:
Everyday at 2am my scheduler checks the Condition to see if it can run. In my case, if I wiggle the mouse after starting the condition but before the 15 minute timer finishes the task quits and doesn’t run; however, if the computer has been idle for 15 minutes it proceeds to the next condition.
Wait for idle for means the computer will wait for the idle state to happen for up to 1 hour before it gives up and cancels the task. Think of these two conditions as ANDs. Only when Start the task only if the computer is idle for AND Wait for idle for are both TRUE will the task run.
In other words, if the computer was already idle for 15 minutes when the task started, then it will immediately launch because that first condition would be true. If this sounds like a bunch of nonsense just keep the defaults. When in doubt do the defaults.
Alright, that’s it for that. Now let’s head over to the last tab.
We want to erect a failsafe so if the task fails for some reason it automatically tries to fix itself.
In the Settings tab put a checkmark in If the task fails, restart every and set the timer to 15 minutes.
Click OK and you’re done!
Merry Christmas Eve by the way. What are you doing reading my site today anyway? Get out and hang with your family!