Command Line Scheduling

I am going to go over some of the basic at command usage and some real world examples of its usage.

at – Run without any switches the program will display scheduled items or inform you that there aren’t any scheduled jobs.
at /delete – Using the /delete switch will make the command prompt you to delete all current entries.
at ID /delete – Using the job ID and the delete switch, the program will clear the specified ID/entry without prompting.
at time command – This is the most common way schedule a single task which will run once.
at time /every:X command – Same as above plus a recurring job based on X, which can indicate a day of the week or month.

I use the at command every day since it is a very simple and effective tool. Below are some common scenarios where you might use at

I often perform maintenance such as Windows Updates which require a reboot but I cannot reboot the server to apply the updates. In this fairly common scenario the solution is very easy, a scheduled reboot. To perform a reboot from the command line of a Windows 2003 server you would run “shutdown -r” and press enter. If you wanted to do this at 3:00am you would simply run “at 3:00 shutdown -r“ from the command line. Another one that I use frequently is the scheduled defrag. I use this on all servers and client computers that I come across: “at 3:oo /every:1 defrag c:” which runs a command line defrag of the c: partition at 3:00am on the 1st of every month. You can substitute the 1 for a day such as M,T,W,Th,F,S,Su or any such combination separated by commas.
There countless useful tools that can be executed from the command line and just about all of them can be ran unattended by using the at command. I highly recommend automating your daily tasks such as defrags, reboots, and system cleanups using this command. It is very important to run the command without any switches after doing any work with the command so you can double check for typos. You can also see your scheduled jobs from the GUI by typing tasks in the run dialog and pressing OK.

–himuraken

Leave a Comment

16 − 6 =