At

Lists scheduled commands or schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the at command.

at [\\computername] [[id] [/delete] | /delete [/yes]]

at [\\computername] time [/interactive] [/every:date[,...] | /next:date[,...]] command

Parameters

none

Used without parameters, at lists scheduled commands.

\\computername

Specifies a remote computer. If this parameter is omitted, the commands are scheduled on the local computer.

id

Specifie the 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

Forces a yes answer to all queries from the system when deleting scheduled events.

time

Specifies the time when the command is to run. Time is expressed as hours:minutes in 24-hour notation (00:00 [midnight] through 23:59).

/interactive

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

/every:date[,...]

Runs the command on every specified day or days of the week or month (for example, every Thursday, or the third day of every month). Specify date as one or more days of the week (M,T,W,Th,F,S,Su) or one or more days of the month (using numbers 1 through 31). Separate multiple date entries with commas. 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). Specify date as one or more days of the week (M,T,W,Th,F,S,Su) or one or more days of the month (using numbers 1 through 31). Separate multiple date entries with commas. If date is omitted, the current day of the month is assumed.

command

Specifies the Windows 2000 command, program (.exe or .com file), or batch program (.bat or .cmd file) to be run. When the command requires a path as an argument, use the absolute path, that is, the entire path beginning with the drive letter. If the command is on a remote computer, specify UNC notation for the server and share name, rather than a remote drive letter. If the command is not an executable (.exe) file, you must precede the command with cmd /c; for example:

cmd /c dir > c:\test.out

Notes

The at command requires you be a member of the local Administrators group. Also, the at command does not automatically load cmd, the command interpreter, before running commands. Unless you are running an executable (.exe) file, you must explicitly load Cmd.exe at the beginning of the command, for example:

cmd /c dir > c:\test.out.

Viewing Scheduled Commands

The at command has two forms of output. When you use at without options, you see a display similar to the following:

Status ID Day Time Command Line
0 Each F 04:30PM net send group leads status due
2 Each M 12:00AM chkstor > check.fil
3 Each F 11:59PM backup2.bat

When you include the identification number for the command, the display provides information for a single entry and is similar to the following:

Task ID: 0

Status: OK

Schedule: Each F

Time of Day: 04:30PM

Command: net send group leads status due

After you schedule a command with at (especially a command that has option variables), check that the command is entered properly by typing at without options. If the information in the Command Line column isn't correct, delete the command and retype it. If it still isn't correct, retype the command with fewer option variables.

Viewing Results

Commands scheduled with the at command run as background processes, so no output is displayed on the computer's screen. To redirect output to a file, use the redirection symbol (>). If you redirect output to a file, you need to use the escape symbol (^) before the redirection symbol. You must use the escape symbol whether you are using at at the command line or in a batch file, as shown in the following example:

at 14:45 c:\test.bat ^>c:\output.txt.

The current directory for the executing command is the %systemroot% directory.

Changing System Time

If you change the system time at a computer after scheduling a command to run with at, synchronize the at scheduler with the revised time by typing at without options.

Storing Commands

Because scheduled commands are stored in the registry, scheduled tasks are not lost if you have to restart the Schedule service.

Connecting to Network Drives

Scheduled jobs that access the network should not use redirected drives made by the user. The Schedule service might not be able to access these drives, or they might not be present if a different user is logged on at the time the scheduled job runs. Instead, scheduled jobs should use Unc paths, as shown in the following example:

at 1:00pm my_backup \\server\share

The following example, where x: is a connection made by the user, should not be used:

at 1:00pm my_backup x:

If you schedule an at command that uses a drive letter to connect to a shared directory, you should include an at command to disconnect the drive when you are finished using it. If the drive is not disconnected, the drive letter assigned will not be available or seen at the command prompt.