Saturday, December 17, 2011

Automatically Shutdown Windows 7 / XP through Command Prompt

There have been many times where I wish a program would shutdown my computer once it has completed its processes. Unfortunately, some programs do not have this option. The following command which is executed in the command prompt will allow you shutdown windows with also the possibility to restart the OS.

If the following code is copied into your command prompt, it will shutdown the computer at 6:30pm
at 18:30 shutdown -s
To confirm task has been added, just type "at" in the command prompt, and you will see the scheduled tasks. If you would like to remove the job type:
at [id] /delete 
//[id] = replace with the ID number to delete
To restart windows, just add -r command. A prompt can also be given to give notification of upcoming shutdown by adding -c. The command can also be generated to work on certain days of the week. Ex:
at 18:30 /every:T,Th,F shutdown -s -r -c "Computer is going to restart!"
The code above says the computer will restart at 6:30pm every Tuesday through Friday and give the message indicating pc is restarting. Hope this helped! IMPORTANT: If this command is being issued through windows 7, please ensure you run command prompt as Administrator or else you will get "Access Denied".

No comments:

Post a Comment