At plans to run commands and programs on the computer at the specified time and date

Source: Internet
Author: User
Tags net send schtasks

At plans to run commands and Program . The at command can only be used when the "scheduler" service is running. If you use it without parameters, at lists the scheduled commands.

Syntax
At [\ computername] [{[ID] [/delete] |/Delete [/Yes]}]

At [[\ computername] hours: minutes [/interactive] [{/every: Date [,...] |/next: Date [,...]}] command]

Parameters
\ Computername
Specify a remote computer. If this parameter is omitted, the at program plans commands and programs on the local computer.
ID
The identifier assigned to the scheduled command.
/Delete
Cancels scheduled commands. If the ID is omitted, all scheduled commands on the computer are canceled.
/Yes
When a scheduled event is deleted, all requests from the system are answered with "yes ".
Hours: minutes
Specifies the time when the command is run. The time is in the 24-hour format (from [Midnight].
/Interactive
For a user logging on when running a command, the command can interact with the user's desktop.
/Every:
Run the command on the specified day of each week or month (for example, every Thursday or the third day of each month.
Date
Specifies the date on which the command is run. You can specify a day or multiple days of a week (that is, type M, T, W, Th, F, S, su) or a day or multiple days of a month (that is, enter a number from 1 to 31 ). Multiple date items are separated by commas. If date is omitted, at uses the current day of the month.
/Next:
Run Command when the next specified date (for example, next Thursday) arrives.
Command
Specify the Windows Command Execution program (.exe or. com file) or batch processing program (. bat or. CMD file) to run ). When the Command needs a path as a parameter, use the absolute path, that is, the entire path starting from the drive letter. If the command is on a remote computer, specify the Universal Naming Convention (UNC) symbol for the server and shared name, instead of the remote drive letter.
/?
Display help at the command prompt.
Note
Schtasks is a more powerful superset command line planning tool that contains all the functions in the AT command line tool. Schtasks can be used to replace at for all command line scheduled tasks. For more information about schtasks, see "".

Use
When using the AT command, you must be a member of the local Administrators Group.

Load cmd.exe
Before running the command, at will not automatically load cmd.exe (command interpreter ). If the executable file (.exe) is not run, you must use the following method to specifically load cmd.exe at the beginning of the command:

CMD/C dir> C: \ test. Out.

View scheduled commands
When at is used without the command line option, the scheduled task will appear in a table similar to the following format:

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 :59 PM backup2.bat
ID)
When you use an AT command with an ID, the information of a single task item is displayed in a format similar to the following:

Task ID: 1

Status: OK

SCHEDULE: Each F

Time of day: 4: 30 pm

Command: net send group leads status due
After a command with at (especially a command with command line options) is scheduled, you need to enter at without command line options to check whether the command syntax is entered correctly. If the information displayed in the "command line" column is incorrect, delete the command and re-type it. If the command is not correct, you can re-type the command with fewer command line options.

View results
Use the scheduled at command to run the program as the background program. The running result is not displayed on the computer. To redirect the output to a file, use the redirection symbol (> ). If you want to redirect the output to a file, you must use the Escape Character (^) before the redirection symbol, whether in the command line or in the batch file ). For example, to redirect the output to the output. Text File, type:

At c: \ test. Bat ^> C: \ output.txt

The current directory for executing commands is the systemroot folder.

Change System Time
After you use the AT command to plan the command to run, if you change the system time of the computer, you can synchronize the at scheduler with the modified system by typing an AT program without the command line option.

Storage commands
Scheduled commands are stored in the registry. In this way, if you restart the "scheduler" service, the scheduled task will not be lost.

Connect to the network drive
Do not use a directed drive for scheduled jobs that need to access the network. The scheduler service may not be able to access these redirected drives, or the redirected drives may not appear if other users log on when the scheduled task is running. Therefore, use the UNC path for scheduled jobs. For example:

At PM my_backup \ Server \ share

Do not use the following syntax (where X :? Indicates the connection established by the user ):

At PM my_backup X:

If an AT command using the drive letter is scheduled to connect to the shared directory, an AT command should be included to disconnect from the drive when the drive is complete. If you cannot disconnect from the drive, the assigned drive letter is unavailable at the command prompt.

Example
To display the list of scheduled commands on the marketing server, type:

At \ Marketing
To learn more about the command 3 on the server Corp, type:

At \ Corp 3
To plan to run the network sharing command on the corp server at AM and redirect the list to the corp.txt file of the maintenance server (under the reports shared directory), type:

At \ Corp 08:00 CMD/C "net share reports = D: \ marketing \ reports >>\\ maintenance \ reports \ corp.txt"
To back up the hard drive of the marketing server to the tape drive at midnight every five days, first create the name archive. CMD's batch processing program (which contains backup commands), and then plan the running of the batch processing program. For this reason, type:

At \ marketing/every: 5, 10, 15, 20, 25, 30 Archive
To cancel all scheduled commands on the current server, clear the at plan information as follows:

At/delete
If the command to be run is not an executable (.exe) file, use CMD/C to load cmd.exe before the command as follows:

CMD/C dir> C: \ test. Out.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.