There might be certain situations where you want to shut down your computer after some time. Maybe you are scanning your computer or downloading files from the internet. If this is your case, then you can create a shut down timer or schedule a shutdown task using windows task scheduler. Here’s how to do so.
Create a Shutdown Timer Batch File
Windows includes commands to shutdown or restart the computer using command line. These commands also allow us to set time-out period before shutdown. Follow the below steps to create a shutdown timer.
- First open notepad and type the following code: shutdown -s -t <time in seconds>
- At time in seconds, enter the time (in seconds) after which you wish to shut down your computer. Suppose I want to shut down my computer after 2 minutes so the modified code will be:
c:\windows\system32\shutdown –s –t 120
Similarly, for five minutes the modified code will be:
c:\windows\system32\shutdown –s –t 300
- In case, if you want to restart the computer then you can use the below command:
c:\windows\system32\shutdown –r –t <time in seconds>
- Now save the file by pressing crtl+s and name it shutdown.bat, make sure to select the file type as “All files”.
- Now whenever you want to set a shutdown timer just double click the shutdown.bat file, and the timer will shut down your computer after the desired amount of time.
- In case if you want to abort the shutdown task then open command prompt and type shutdown –a and press enter.
Manually Schedule a Shutdown Task
This is yet another method to shutdown your computer after certain amount of time. The advantage of this method is it automatically shutdowns the computer daily at a specific time.
- Press Windows + R to open the run window. In the run box type taskschd.msc and press enter. This will open Windows Task Scheduler.
- On the right-hand side click on Create basic task.
- Enter the desired name and description for the task.
- Next, you will be asked when you want to start the task, Select one time and click Next. If you want to shut down your computer daily at a specific time, then you can select Daily.
- Now enter the time when you wish to shut down your computer and click Next.
- Again press next and at shutdown script type shutdown and in the argument box type -s -f -t 0.
- Click next and hit the finish button.