ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software

Windows scheduler using Command Prompt

Updated on October 20, 2012

Introduction

With our very busy schedule, we sometimes want some things to be automated. That is the idea of programming: to automate. Programs are made to make our lives easier. They do a series of tasks that are necessary for a single job to be done.

Windows offers a very powerful utility. That is command prompt. It looks intimidating but it is really easy to use. It has a lot of commands that will let you do tasks the “old-school-way” or do some others that is only possible in CMD. To be know all the commands in the command prompt, type “help” in the console then it will list most commands. There are also other commands that are not listed like “telnet.”

In this article we will be talking about how to schedule programs using this program. The command we will be using is the “at” command. It uses the Windows Scheduler service to set a program to execute on a given schedule.

example: the at command executing cmd.exe at 10:42pm.
example: the at command executing cmd.exe at 10:42pm.

The "at" Command

In Windows 7 and Vista, you need to run the command prompt as administrator to be able to use the “at” command. To do this, type “cmd” in the search dialog then right click cmd.exe then choose run as administrator. If a dialog box appears, click yes. This gives Command Prompt special access privileges on your computer. If Command Prompt is not ran as an administrator, you will not be able to do anything with the “at” command. An “Access denied” message will always appear.

The syntax of the “at” command as command prompt says is this:

“AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]

AT [\\computername] time [/INTERACTIVE]

[ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted.

id Is an identification number assigned to a scheduled command.

/delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled.

/yes Used with cancel all jobs command when no further confirmation is desired.

time Specifies the time when command is to run.

/interactive Allows the job to interact with the desktop of the user who is logged on at the time thejob runs.

/every:date[,...] Runs the command on each specified day(s) of the week or

month. If date is omitted, the current day of the month is assumed.

/next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed.

'command' Is the Windows NT command, or batch program to be run.”

You can make the above text show up in command prompt by typing “at /?”

A command may be a program (*.exe) or a batch script (*.bat). Time is in military time, i.e. 1pm is 13:00. In Windows 7, the “/interactive” switch will not work meaning you will not be able to interact with the executed program. If you try to do that, Command Prompt will inform you to use “schtasks” instead.

An example of the use of the “at” command is the picture above. If you wish to execute a program outside of “Windows/System32.” You will need to indicate the complete path to the program. Example:

At 14:22 “c:\program files\batch files\filename.bat”

This creates a schedule for a filename.bat script to run at 2:22 pm. It will only run once. If you want to run it multiple times, add the /every:date script.

"schtasks"
"schtasks"

Alternative

Another command is, as mentioned earlier, “schtasks.” You can find out the syntax of the command by typing “schtasks /?” It works much like the “at” command however the syntax is different and you get to have more control.


Comments

    0 of 8192 characters used
    Post Comment

    • leakeem profile image
      Author

      leakeem 5 years ago from Earth

      Thanks chefmancave! I'll check that out.

    • chefmancave profile image

      Robert Loescher 5 years ago from Michigan

      Leakeem...Good description of the AT command. Check out the hubpage on Windows Scripting Host and Autoit. If you are a Command Line geek like me, you will absolutely love AutoIt.