Do you like scheduling each and every thing in your life whether it’s a simple meet up with a friend or logging off your computer system at the lunch time? Let your computer sleep when you are inactive but it should wake up when you enter the office room? Well, we can easily schedule shut down, restarts or logging off Windows automatically at a specific time. All it requires is a one time effort of creating and scheduling it. Let’s start step by step.
Shutdown computer at a specific time
Go to Start -> Control Panel -> System and Security
Under System and Security look for the Administrative Tools -> Schedule Tasks
This will open the task scheduler. Our aim is to automatically shut down computer at a specific time and we will schedule a task to do so.
You can also directly open the task scheduler by going to Run –> Taskschd.msc
Go to Actions -> Create Basic Task
Note that ‘Create Task’ is used to perform multiple actions simultaneously. Give a suitable name and description to the task and click next.
It will take you to ”Task Trigger’ and asks how often do you want to perform that task.
Select Daily and set your timings. We have set it to 12:00 AM at night. You may also synchronize it across time zones if you travel often.
Click Next and select the action you want to take.
Select ‘Start A Program’.
Enter the script that will shutdown the computer. It is a simple run command
Clicking on the next button will take you to the task summary which describes the task name, program to be executed and its trigger. Click Finish to activate the task.
You can now re-check your activated tasks in the ‘Active Tasks’ list.
Restart Automatically at Specific Time
Restart computer automatically by performing the same series of steps as discussed above. However, run the following command at the scheduling task.
Log Off Automatically at Specific Time
Yes, you guessed it right. A simple command in the script is enough to tell the system that the user wants to logs off.
Hibernate Automatically at Specific Time
Similarly you can also schedule hibernation of your system following the same procedure.But this time, type in the following script in the ‘start program’ bar.
Usually we don’t need hibernation as a schedule task rather it should be event driven i.e. whenever you leave computer for a specific time period it should be wise enough to fall asleep. To customize these settings:
Go to Start-> Control Panel -> System and Security
Power Options ->Change when the computer sleeps
There are three power plans Balanced, Higher Performance and Power Saver. We use ‘Balanced’ plan as default so it is displaying adjustable options that can be used to set the sleep time, display dim and off timing.
Click on the ‘Change advanced power settings’. With the help of advanced options you can customize all power plans and specify a lot of stuff distinctly. Although , you can change it to ‘No’ but make sure that you ask for a password whenever a computer wakes up so that unauthorized access is prevented.
In the Advanced Options window, scroll down to find Sleep -> Hibernate After.
Set your hibernation timings in minutes when you are using system on battery or plugged in.
Apply the changes and select OK.
Debug and Edit Scheduled Tasks
We just realized that one of our task did not execute on time…how to debug it now? Let’s start ‘Task Scheduler’ to dig out the problem and fix it.
Go to Start -> Search Bar -> Task Scheduler
In the Active Tasks Section, scroll the list and find your required task. We are trying to change some settings in our PC Auto Shutdown task.
Double click the task name and it will display complete information about it.
To edit the conditions and settings, go to the properties in the right side panel.
A property window will open. We made an error in the action script so we went to ‘Action’, clicked edit and removed the error.
There are many tools available which offer the automatic scheduling of shut down, restart and log off options etc. Some of which are as follows:
Shutdown, Restart, Logoff, Hibernate PC after a specific amount of time
If you want to shutdown the PC after a specific amount of time, you can do so by using the following command:
“shutdown -s -t 30”
Where -s specifies that the system has to shutdown, -t means we are defining a time interval and 30 means the system should shutdown after 30 seconds. For restart, the following command will be used:
“shutdown -r -t 30”
“shutdown -l -t 30”
And for hibernation:
“shutdown -h -t 30”
If anything goes wrong and you want to cancel the count down or scheduling of the shutdown command immediately, just issue the following command: