How-To Geek

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


If you normally like to power off your PC when you’re not using it, 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.

To accomplish this, we’ll setup a Task Scheduler job that tells the computer to shut down, and make sure to configure the rules so that it doesn’t kick in if you are up late using the PC.

Create a Task Scheduler Job to Shut Down the PC

You’ll need to open up Task Scheduler to create the new job, so open it up and click the Create Task link on the right-hand side.


Now you’ll want to give the task a name, and make sure to check the box for “Run with highest privileges”, since the shutdown utility requires admin access.


Now switch to the Triggers tab, click New, and then setup a schedule that makes sense for you, like every night at midnight.


Now flip over to the Actions tab, click New, and then enter shutdown into the Program box, and /S into the parameters box. If you want to force a shutdown and kill every app, you can use /S /F to force it to happen right away.


Next head to the Conditions tab, and make sure to check the box to only start the task if the computer is idle for more than x minutes. You can also choose to stop the task if the PC isn’t idle to help make sure it doesn’t kick in if you are on the PC.


Lastly, head to the Settings tab, and you can choose to restart the task every 30 minutes if the task fails—that way, if you are on the PC for a while past the normal time, the job will start up later on and shut down the PC.


Once you’re done, your PC will shut down automatically. Enjoy!

Want to make your PC do something other than shut down? Read our article on creating shortcuts to restart, shut down, hibernate, or sleep mode.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 10/4/10

Comments (28)

  1. Anonymous

    … OR you could just download a program that does it with a few clicks.

  2. John Horne

    I’m going to try it, but how do I remove the task if I don’t like it?

  3. Kalle

    Do I have to be logged as administrator to be able to run this task?

  4. Mike

    Liking this, but I would need an addition: only when you’re not using it AND only when I’m not downloading something.

  5. Srikanth

    I like “shutdown monster”, its so lite, and easy to setup everytime.

  6. Srikanth

    John Horne : Right the task and click “delete”.

    Kalle : All type of users can use Task Scheduler.

  7. Lorenzo

    What if i want it to turn back at the same time everyday? How do i schedule that?

  8. alkolkin

    I use the Task scheduler regularly and one thing is not very clear. What is the definition of idle?

    I ask that because my computer is never idle. When I leave Firefox on, it does something every couple of seconds. My backup software, ShadowProtect Desktop, is monitoring. Other programs use a couple of micro seconds as well.

    Therefore, my apparently stupid question (my terminology) is not so stupid to me. How would your shutdown (or sleep) be affected by these small uses of CPU?

    Geezer Al strikes again!

  9. Nismo19

    @alkolkin – Good point! I was thinking the same thing. Most apps that take a while to do things have a ‘shutdown when complete’ switch, I would just use that or a fixed time shutdown/hibernate.

  10. Nick P

    I kind of do a combination of this and the sleep/hibernate options.

    I have two power settings configured – “All Day On” and “Overnight Sleep”. One keeps everything on, and the other puts everything to sleep if idle for 5 minutes and eventually hibernates.

    Using the cmd “Powercfg /list” I got the GUID for the two power settings and just set up a task to switch to the overnight settings late at night and back to the the all day settings in the morning using the cmd Powercfg /setactive {GUID}.

    Works like a charm.

  11. alkolkin

    Thank you @Nismo19. I use a product called WinBatch that has an enhanced Basic-like language that gives one the ability to check on the cpu cycles that are being used. It could be used to monitor cpu cycles for, let us say, 15 seconds. It could be programmed so if it stays below a threshold then it puts the computer to sleep. If someone want to wake the computer at certain times, that could easily be done using the Task Scheduler. My view is that this article from howtogeek was not accurate, that is why I asked the question about the definition. It is possible, after all, that the Task Manager automatically looks at some threshold. My version of Winbatch enables me to produce compiled or uncompiled programs.

    Yes most programs that do take a long time to run have a shutdown switch. ShadowProtect has something even better. It allows you to run a script afterward and that script could affect an orderly shutdown, sleep or do anything else that the user wants. Some versions of Acronis have a similar capability.

  12. alkolkin

    @Nick P. While what you say is true, the way to keep your electrical bill the lowest is to put your computer to sleep whenever you leave your desk. To have a product do that for you is more likely to have the desired affect. If you are in the corporate world, then security is also a concern, but I know from my IT days, it is VERY difficult to enforce in a large company.

  13. Bill

    The comments about what defines “Idle” have always bothered me too . Like the other comments,
    my CPU always seems to be doing something. Is there a program that shutdowns my computer
    when the MOUSE is idle ( for ex. not moved for 10 minutes ) ?

  14. Lisa

    I too am curious about the definition of “idle”, seems that programs running on the PC keep it in a constant state of use.

    Also, I am running Vista Home Premium and I saw no “parameters” box to enter /s/f. There was an arguements(optional) box, would that be the same?

  15. gggg


  16. alkolkin

    WOW! AllOff is perfect. I was just trying to figure out how to program the computer to do this stuff @Bill, and your recommendation is perfect.

    Thank you so much. Kudos.

    howtogeek I strongly urge you to correct your suggestion and use his utility instead.

  17. ticotexas

    doesn’t work for me. something must be running so that it is not seen as being “idle”

  18. varun

    Like others I have concerns about “idle” – but in the opposite way of most people.

    You see, I’d like my media center to restart in the middle of the night, but only if it’s not recording any programs. If idle simply means no mouse movement, I fully suspect that I’m going to loose parts of recording programs.

    How do I check that it’s not recording?

  19. Jill

    I’ve set this up at home and it works great. But I’d like to know how to set it up on my system at work, which runs WinXP. When I go to the task scheduler, it opens up a wizard and asks which program you want to run. Shutdown is not an option.

  20. Roi

    “Idle” means no MOUSE movements for X minutes. the CPU is being used 24/7 so it would be illogical to count any CPU activity as non-idle.

  21. Kalle
  22. Mohamed Ashraf

    Idle in computer terms means no user interaction such as no mouse, keyboard, or another user controlled peripherals. Eg watching a video is considered idla if you are not using the mouse or keyboard.

    Also I really liked the article I always want to hibernate the pc if I am not using it however I was wondering if there was a way to stop it if I was downloading something. I am thinking if I make a ahk script to move the mouse a little when I download something so that the computer would not be considered idle

  23. blazer2704

    excellent article

    need this coz i sleep and the laptop is on the whole night

    Awesome thanks

  24. Krikor

    how would you do this on windows xp

  25. Shan

    What option in the task wizard do I pick for shutting it down after I manually ask it to install the updates and it installs them?

    p.s. I stopped using the auto updates in Windows 7 after the darn thing rebooted for updates without warning me before I saved a file.

  26. wolfencj

    For XP users. Open the Scheduled Tasks window and right click -> New -> Scheduled Task.
    This will create a new task than you can edit to the specifications above.

  27. Dayle

    The easiest way to do this on ANY windows OS, is to simply go to START > RUN >
    “at 00:00 shutdown -s” (then type this in without speech marks) This is a simple command that will shutdown the pc at 00:00 hours, you can change this value to any time you want within a 24 hour clock so if I wanted to shut it down at 10pm I would type “at 22:00 shutdown -s” , also you can make your pc log off at a certain type or restart to do this you just change the last value (-s) here are the commands
    -s =shutdown
    -r = restart
    -l =log off
    Hope this helps :)

  28. Desmond

    Wish it will be good and finished

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!