Command at in Windows

The at command schedules commands and programs to run on a computer at a specified time with a specific date. You can only use the command at when Schedule service is running.

Applies to : Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012.

The at command schedules the commands and programs to run on a computer at a specified time, with a specific date. You can only use the command at when Schedule service is running. If used without parameters, the at command will list the scheduled commands.

Command at in Windows

  1. Syntax
  2. Parameters
  3. Note
  4. For example

Syntax

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

Parameters

ParameterDescription Specifies a remote computer. If you omit this parameter, schedule the commands and programs on the local computer. Specify the ID assigned to a scheduled command. / delete Cancel a scheduled order. If you ignore the ID, all commands scheduled on the computer will be canceled. / yes Yes yes to all queries from the system, when you delete scheduled events. Specify the time when you want to run the command. Time is indicated in hours: minutes according to the 24-hour symbol (ie, 00:00 [midnight] to 23:59). / interactive Allows the command to interact with the desktop of the logged-in user at the time of the run command. / every: Run the command every day or specific day of the week or month (eg every Thursday, or the third day of each month). Specify the date you want to run the command. You can specify one or more days of the week (that is, enter M, T, W, Th, F, S, Su ) or one or more days in the month (that is, enter 1 to 31 ). Separate multiple date entries with a comma. If you skip the date, the at command will use the current date of the month. / next: Run the command at the next occurrence of the day (for example, next Thursday). Specify commands, Windows programs (ie .exe or .com files ) or batch programs (that is, .bat or .cmd files ) that you want to run. When the command requests the path as an argument, use the absolute path (ie the entire path begins with the drive letter). If the command is on a remote computer, specify the Universal Naming Convention (UNC) symbol for the server and share that name, instead of using the remote drive letter. /? Show help at the command prompt.

Note

  1. schtasks is another command line planning tool that you can use to create and manage scheduled tasks.
  2. To use the at command, you must be a member of the local administrator group.
  3. The at command does not automatically load Cmd.exe, the command interpreter, before running the command. If you do not run the executable file (.exe), you must load Cmd.exe before running the following command:
 cmd / c dir> c: test.out 
  1. When you use without the command line option, scheduled tasks will appear in the table formatted similarly as follows:
 Status ID Day time Command Line OK 1 Each F 4:30 PM net send group leads status due OK 2 Each M 12:00 AM chkstor> check.file OK 3 Each F 11:59 PM backup2.bat 
  1. When you include an identifier (ID) with the at command at the command prompt, the information for an entry appears in the format similar to the following:
 Task ID: 1 Status: OK Schedule: Each F time of Day: 4:30 PM Command: net send group lead status due 
  1. After you schedule the at command, especially the command with the command line option, check the command syntax correctly by typing at without the command line option. If the information in the Command Line column is incorrect, delete the command and re-enter it. If it is still incorrect, retype the command with fewer command line options.
  2. Commands are scheduled with the at command running as background processes. The output is not displayed on the computer screen. To redirect output to a file, use the navigation icon ( > ). If you redirect the output to a file, you need to use the exit ( ^ ) icon before the redirect icon, whether you are using the at command at the command line or in the batch file. For example, to redirect the output to Output.text, type:
 at 14:45 c: test.bat ^> c: output.txt 
  1. The current directory for the executable command is the systemroot folder .
  2. If you change the system time at a computer, after you schedule a command to run at, synchronize the scheduler with the time the system was modified by typing at without the line option. command.
  3. Scheduled commands are stored in the registry. Therefore, you do not lose scheduled tasks if you restart the Schedule service.
  4. Do not use a redirected drive for scheduled jobs that need access to the network. Schedule service may be inaccessible to the redirected drive or the redirected drive may not be present, if another user logs in at the time the scheduled task is run. Instead, use the UNC path for scheduled jobs. For example:
 at 1:00 pm my_backup servershare 

Do not use the following syntax, where x: is the connection made by the user:

 at 1:00 pm my_backup x: 

If you schedule an at command to use a drive letter to connect to a shared folder, include the at command to disconnect the drive, when you are not using it. If the drive is not disconnected, the specified drive letter is not available at the command prompt.

  1. By default, tasks scheduled using the at command will stop after 72 hours. You can modify the registry to change this default value.

1. Open the registry editor (regedit.exe).

2. Locate and click the following key in the registry:

 HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSchedule 

3. On the edit menu, click Add Value, and then add the following registry value:

 Value Name: atTaskMaxHours Data type: reg_DWOrd Radix: Decimal Value Data: 0. 

The value 0 in the value data field indicates no limit, no stop. Values ​​from 1 to 99 indicate the number of hours. Be careful!

  1. Modifying the registry incorrectly may damage your system. Before making changes to the registry, you should back up any valuable data on your computer.
  2. You can use the Scheduled Task folder to view or modify the settings of a task that was created using the at command. When you schedule a task with the at command, the task is listed in the Scheduled Tasks folder , with the following name: at3478. However, if you modify a task through the Task Scheduled folder , it will be upgraded to a normally scheduled task. The task is no longer displayed with the at command and the account settings no longer apply to that command. You must explicitly enter the user account and password for the job.

For example

To display the list of commands scheduled on the Marketing server, enter:

 at marketing 

To learn more about an order with ID 3 on a Corp server, enter:

 at corp 3 

To schedule a net share command to run on the Corp server at 8:00 am and redirect the list to Maintenance server, in the Shared Reports and Corp.txt files , enter:

 at corp 08:00 cmd / c "net share reports = d: marketingreports >> maintenancereportscorp.txt" 

To back up the Marketing server's hard drive to a drive at midnight, every five days, create a batch program called Archive.cmd, containing backup commands and then schedule it to run the batch program, please import:

 at marketing 00:00 / every: 5,10,15,20,25,30 archive 

To cancel all the commands scheduled on the current server, delete the following schedule information:

 at / delete 

To run a command that is not an executable file ( .exe file ), add cmd / c before the command to load Cmd.exe as follows:

 cmd / c dir> c: test.out 

See more:

  1. Bcdboot command in Windows
  2. The autofmt command in Windows
  3. The autoconv command in Windows
4.5 ★ | 2 Vote