How-To Geek

How to Make Your PC Shut Down at Night (But Only When You’re Not Using It)


It’s good to to power off your PC when you’re not using it, but do you ever forget and leave it on? Here’s how to configure Windows to automatically power down at night, but only if you’re not using the PC at the time.

We really recommend putting your PC to sleep rather than shutting it down as a normal course of action. Sleep and hibernation have both come a long way since the early days of Windows and if you avoid using them because you used to have problems, you might be pleasantly surprised with how well they work now. And if you still have trouble with your PC waking up prematurely, we have some advice for keeping that from happening.

Of course, if you’d really like to shut your PC down automatically instead, we understand. And it isn’t hard to do. You just need to set up a scheduled task with rules to prevent the shut down if you’re up late using the PC.

Click Start, type “task scheduler,” and then click the “Task Scheduler” app.


In the Task Scheduler window, in the “Actions” pane, click “Create Task.”


On the “General” tab of the Create Task window, give the new task whatever name you want. We like putting a “z_” before any user-created tasks just so that they’re easier to find later with a quick alphabetical sort. Select both the “Run whether user is logged on or not” option and “Run with highest privileges” options. On the “Configure for” drop-down, select your version of Windows.


Next, switch to the “Triggers” tab. Click “New” to create a new trigger.


In the New Trigger window, make sure the “Begin the task” dropdown menu is set to “On a schedule.” Set up whatever schedule you like. Here, we’re going with every night at midnight. When you’re done setting up your schedule, click “OK.”


Back in the “Create Task” window, switch over to the “Actions” tab and click “New” to create a new action.


In the “New Action” window, set the “Action” drop-down menu to “Start a program.” Type “shutdown” into the “Program/script” box. In the “Add arguments (optional)” box, type “/S” to have have the task start a basic shutdown command—the same as if you’d clicked the Shut Down button yourself. If you want the command to also force any running applications to close without warning users, type “/S /F” into the “Parameters” box instead. When you’re done, click “OK.”


Back in the “Create Task” window, switch over to the “Conditions” tab. Enable the “Start the task only if the computer is idle for” option and set the timing you’d like. Here, we’re setting the task to kick in only if the computer has been idle for 15 minutes when the shut down time arrives. We’re also setting the task to wait up to one hour for that idle time to happen.

You also have two other options to consider here. Enable the “Stop if the computer ceases to be idle” option to stop the task if you start using your PC. And enable the “Restart if the idle state resumes” to have the task begin measuring idle time again when you stop using your PC. We recommend going ahead and enabling both those options.


Next, switch to the “Settings” tab. Here, you can set your task up so that it will run again every so often if it fails to run successfully. This lets the task shut down your PC if you’re up using it for much longer than you expected to be. Enable the “If the task fails, restart every” option and then set your preferences. Here, we’re having the task restart every thirty minutes and we’re letting it try restarting up to three times. When you’re done, click “OK” to create the task.


Note that you will likely be asked to enter your user account password to finish creating the task. And you can now exit Task Scheduler. From this point on, your PC should shut down automatically at whatever time you scheduled—unless you’re using the PC at that time.

Walter Glenn is a long time computer geek and tech writer. Though he's mostly a Windows and gadget guy, he has a fondness for anything tech. You can follow him on Facebook and Twitter.

  • Published 01/22/17
  • Dan Fuss


    Is there a way to time schedule sleep rather than shutdown?

    I want to have my laptop go to sleep at a certain time every evening and wake at a certain time every morning but not have it go to sleep during the day when plugged in with the lid closed. This is because I access my laptop from work using TeamViewer and can't use Wake From LAN.

    I'm not too tech savvy, so sorry if the answer to this is really simple . Thanks!

  • Gordon Hay

    An alternative to the "z_" prefix as a way to find user-created tasks is to add a new folder under the Task Scheduler Library and create those tasks in there.

  • Hugo Arlman

    I have two reasons I don't put the HP PC to sleep. (1) I read a couple of years ago in one of the techy websites it improves PC-life because shutting down cleans all the unnessary stuff; (2) my bluetooth Logitech mouse and keyboard don't wake up after sleep so I have to restart again. But I might be wrong in both.

  • Andrew P.

    I, too, have noticed quirks with Windows PCs resuming from sleep, such as sometimes not reconnecting to the wireless LAN, and then services such as Google Drive not working properly. The only fix then seems to be a restart or shutdown and cold boot.

  • Heck No Techn O

    Is there a script to put it to sleep on a schedule?

  • Biswa
  • Pradip Shah

    I have been using different method to shutdown the PC when the jobs on hand like downloads or video conversion are complete. I use a loop back batch file to monitor download application running in background which would exit upon completion of the job. I also monitor % of CPU usage to check if video conversion is complete. When all criterion is met the batch file would run a command to shutdown the PC.One can easily set the PC to start at specific time by seting the BIOS accordingly. I have 3 different internet services and depending on the time of day a startup batch file would enable / disable appropriate interface as well as IP controlled 4 socket power strip to switch on the appropriate router and connect using netsh commands.

    On PCs that do not wake from sleep the problem is usually with the hardware bios. Recently I was forced to replace my DH77EB Intel motherboard - which IMHO is absolute junk - with Asus H61M-CS. Although the chip set is older than on the Intel motherboard ALL my problems disappeared.

More Articles You Might Like