AT.exe

Schedule a command or batch file to run on a computer at a specific date and time. Additional scheduling options are available with the SCHTASKS command. The AT command has been deprecated and is no longer available In Windows 8.

Syntax
      Create an AT job:
      AT [\\computername] hh:mm [/INTERACTIVE] [ /EVERY:day(s) | /NEXT:day(s) ] "command"

      Delete an AT job:
      AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]] 

Key
\\computername : Execute the AT command on a remote computer. id : An id number AT assigns to each scheduled job. /delete : Cancel a scheduled job. If id is omitted, all jobs are deleted. /yes : Use with /delete to supress the confirmation message. hh:mm : The time to run the command. /interactive : Allow the job to interact with the desktop of the current user when the job runs. /every:day(s) : Run the command every day(s) of the week or month. (default: dd=today) /next:day(s) : Run the command on the next occurrence of the day. (default: dd=today) "command" : The batch program or command to run. If the path to this includes spaces, put double quotation marks around the path. "C:\Program Files\My Batch.cmd"

Day(s) are in this format: (English Locale EN)

Monday = m
Tuesday = t
Wednesday = w
Thursday = th
Friday = f
Saturday = s
Sunday = su

or a specific day of the month:
e.g. 5th of every month = 5

In other locales the day(s) may be different letters:
Italian: L,MA,ME,g,v,s,d
German: M, T, W, Th, F, S, Su
French: L, Ma, Me, J, V, S, D

AT vs 'Scheduled Tasks'

The "Task Scheduler" service must be running to use the AT command. The "Schedule" service (ATSVC) rather than the "Task Scheduler" service must be running to use SOON with a delay of less than 60 seconds. - see Q237840

You can use the Scheduled Tasks folder to view or modify the settings of a task that was created by using the AT command. When you schedule a task using the at command, the task is listed in the Scheduled Tasks folder, with a name such as:At3478. However, if you modify an AT task through the Scheduled Tasks folder, it is upgraded to a normal scheduled task. The task is no longer visible to the at command, and the at account setting no longer applies to it. You must explicitly enter a user account and password for the task. For most purposes the SchTasks command is a better choice than AT.

Commands to Process

At does not automatically load Cmd.exe, the command interpreter. If you are not running an executable (.exe) file, you must explicitly load CMD at the beginning of the command e.g. cmd /c dir
Don’t try to pass more than one command into AT, put multiple commands into a batch file and then call the batch file from AT.

Permissions required to issue an AT command

By default only a Local Administrator can issue an AT command, a Domain Admin can direct an AT command at any machine. AT will run commands under the local SYSTEM account, under Windows XP this can be used as a source of privilege escalation.

Permissions required by the service account

The User Account under which the Schedule service runs may require specific file access permissions, user permissions and drive mappings.
The User Account is selected under MyComputer, ScheduledTasks, Advanced (Menu), AT Service Account. You also need to stop and restart the service before the change in UserAccount will take effect.

Here's how to check if a user account has sufficent rights for a particular task:

C:\> AT 14:32 /interactive %comspec% /k

Setting hh:mm for one minute from now will open a cmd window at the specified time. In this window you can check the following settings:

Next, go ahead and run your batch file in this console window, note the errors, and fix them. Once the errors have been fixed, you can remove the /interactive switch and schedule the batch file with some confidence that it will work as intended.

Bugs

If you change the system time after scheduling a command with AT, synchronize the scheduler with the revised system time by typing AT without any command-line options.

By default, AT jobs will stop running after 72 hours.
You can modify this in the registry.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Schedule
Value:
AtTaskMaxHours Data type: REG_DWORD
Decimal Value Data: 0.
A value of 0 indicates no limit, does not stop.
Values from 1 through 99 indicate the number of hours.

Other Task Scheduler options are stored in the registry

HKLM\SOFTWARE\Microsoft\SchedulingAgent\

Examples:

Run a command every day

AT 23:30 /EVERY:m,t,w,th,f,s,su c:\backups\every_day.cmd

Run a command every Friday

AT 23:30 /EVERY:f c:\backups\weekly.cmd

Remove all scheduled AT jobs

AT /delete /yes

Run a command this evening (once only)

AT 23:30 /NEXT: c:\backups\today.cmd

“We don’t wake up for less than $10,000 a day” - Linda Evangelista

Related:

SchTasks - Task Scheduler
CALL - Call one batch program from another.
Powershell: To schedule a PS task call Powershell.exe
JT.exe (Microsoft FTP) - Manage the Task Scheduler from the command line
WMIC JOB - WMI access to scheduled tasks.
Equivalent bash command (Linux): crontab - Schedule a command to run at a later time


© Copyright SS64.com 1999-2014
Some rights reserved