≡ Menu

How to Schedule Automatic Shutdown

If you are running some application or downloading something on your system, and it’s going to take a while, do you want to just wait on that to be completed before you go away? Would not it be nice to have the system shutdown automatically after all your tasks are done? This post shows exactly this – how to schedule shutdown of your computer at a given time.

First thing you need to do is estimate how long the tasks/programs you are running would take and may be add some grace time to that. Let’s say it takes 2 more hours, then may be add another half an hour as buffer in case it’s delayed for some reason. So you would want to shutdown the system after 2.5 hours.

There are multiple ways to schedule auto shutdown. Each of these options should work on every version of Windows – Windows 7, 8 and 10.

  1. Simplest way is to open a command prompt and run the below command.
    sleep 9000; shutdown -s

    It sleeps for 9000 seconds and then shutdown the computer. If you see below error, read sleep command to get the command on to your computer.

    C:\> sleep
    'sleep' is not recognized as an internal or external command, operable program or batch file.
    C:\>
  2. You can use at command to schedule shutdown. Here we need to specify the exact time the command should run at. Let’s say the current time is 1pm and you want to shutdown after 2.5 hours.
    at 03:30:00PM shutdown -s

    In this case, you can exit the command prompt as the command is scheduled where as with ‘sleep’ you need to keep the window open.

  3. You can use schtasks command.
    schtasks /create /sc once /tn "auto shutdown my computer" /tr "shutdown -s" /st 15:30

Schedule daily shutdown

Below I show you how to schedule automatic shutdown daily. We can use either at or schtasks for this. Below you can see example commands to schedule shutdown at 11pm every day.

  1. At

    At 11:00:00PM /every:M,T,W,TH,F,SA,SU shutdown -s
  2. schtasks

    C:\>schtasks /create /sc daily /tn "auto shutdown my computer daily" /tr "shutdown -s" /st 23:00
    SUCCESS: The scheduled task "auto shutdown my computer daily" has successfully been created.

Schedule automatic restart

The above commands are for shutting down computers.  If we need to restart instead, we can simply add the right argument to the shutdown command. For example to restart computer at 11pm just for today, the command would be

at 11:00:00PM shutdown -r

If you want to use sleep

sleep number_of_seconds_to_wait; shutdown -r
3 comments… add one
  • Graham

    Great tips, thanks for sharing

  • Chen

    I was wondering why my windows was rebooting everyday automatically, figured out the reason – there’s a daily reboot task hiding in task scheduler, I experiment a lot with my system, looks like I created one earlier and completely forgot about it.

  • George Spelvin

    “The AT command has been deprecated. Please use schtasks.exe instead.”

    No longer an option with Win10

Leave a Comment