The at.exe is a command-line utility in Windows operating systems that allows you to schedule tasks to run at a specified time. It can be used to create, view, modify, or delete scheduled tasks, enabling you to perform various operations from the Command Prompt or batch files.
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
Examples
Running a command every day
AT 23:30 /EVERY:m,t,w,th,f,s,su c:\backups\every_day.cmd
Running a command every Friday
AT 23:30 /EVERY:f c:\backups\weekly.cmd
Running a command this evening (once only)
AT 23:30 /NEXT: c:\backups\today.cmd
Rights needed to issue an AT command
By default only an Administrator can issue an AT command, and a Domain Admin can direct the command at any machine.
To configure an AT job as part of a users login script – the user must be a member of the local Administrators group.
Be aware that a global workgroup setup with ‘Local Administrator’ rights would allow every member full control of not only their own workstation but EVERY workstation on the network.
To setup a workstation so that anyone logging in will have local admin rights (to that machine only) use the command:
NET LOCALGROUP "Administrators" INTERACTIVE /add
or
NET LOCALGROUP "Power Users" INTERACTIVE /add
The “Schedule” service must be running to use the AT command. If you have Internet Explorer 5.0 or greater this is renamed as the “Task Scheduler” service. Task Scheduler has a bad reputation due to a security vulnerability it introduced – however this was fixed with IE 5.01
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
User Rights needed for the AT command to perform it’s task
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
Control Panel, Services, SCHEDULER, Startup, Logon As…
If you have Internet Explorer 4 or greater the User Account is selected under
SCHEDULED TASKS, Advanced, AT Service Account.
You also need to *stop* and restart the service before the change in UserAccount will take effect.
Don’t try to pass more than one command into AT, put everything you want to achieve in one batch file and then just call that batch file from AT.
Here’s how to check if a user account has sufficent rights for a particular task:
AT hh:mm /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:
The PATH Environment variables (particularly TEMP).
Drive mappings – you can add these by putting appropriate NET USE… commands at the beginning of your batch file.
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.
The Scheduled Tasks GUI
Scheduled tasks are available with IE 4.0 + and extend the functionality of AT, particularly in the area of permissions.
The Task Scheduler option adds an extra folder (and extra menu options) to Windows Explorer.
Task Scheduler options are stored in the registry
HKLM\SOFTWARE\Microsoft\SchedulingAgent\
See Q226370 for bugs related to the Task Scheduler. Also note that using the GUI to edit a Scheduled Task (as opposed to editing at the command line) you are required to supply the password for the user account under which the task will run. (In other words the task can no longer run under the system account)