In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how dos uses the at command. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
At plans to run commands and programs on your computer at a specified time and date. The at command can only be used when the schedule service is running. If used with no parameters, at lists the scheduled commands.
Grammar
At [\ ComputerName] [{[ID] [/ delete] | / delete [/ yes]}]
At [[\ ComputerName] hours:minutes [/ interactive] [{/ every:date [,...] | / next:date [,...]}] command]
Parameters.
\\ computername
Specify the remote computer. If this parameter is omitted, at plans commands and programs on the local computer.
ID
Specifies the identifier assigned to the scheduled command.
/ delete
Cancel the scheduled command. If ID is omitted, all scheduled commands on the computer are canceled.
/ yes
When you delete a scheduled event, answer "yes" to all queries from the system.
Hours:minutes
Specifies the time when the command runs. The time is expressed in the hour: minute format of the 24-hour system, that is, from 00:00 [midnight] to 23:59.
/ interactive
For a user who logs in while running command, command is allowed to interact with the user's desktop.
/ every:
Run the command command on a 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 one or more days of the week (that is, type M, T, W, Th, F, S, Su) or one or more days of the month (that is, type a number from 1 to 31). Separate multiple date entries with commas. If date is omitted, at uses the current day of the month.
/ next:
Run command on the next specified date (for example, the next Thursday).
Command
Specify the Windows command, program (.exe or .com file) or batch program (.bat or .cmd file) to run. When the command requires a path as an argument, 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 share name, not the remote drive letter.
/?
Displays help at the command prompt.
Annotation
Schtasks is a more powerful superset command-line planner that contains all the features of the at command-line tool. For all command-line scheduled tasks, you can use schtasks instead of at. For more information about schtasks, see ".
Use at
When using the at command, you are required to be a member of the local Administrators group.
Load Cmd.exe
At does not automatically load Cmd.exe (command interpreter) before running the command. If the executable file (.exe) is not running, the Cmd.exe must be specifically loaded at the beginning of the command using the method shown below:
Cmd / c dir > c:\ test.out.
View scheduled commands
When using at without a command line option, scheduled tasks 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 11:59 PM backup2.bat
Contains identification number (ID)
When you use the at command with an identification number (ID) at the command prompt, information for 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
When you plan a command with at, especially a command with command-line options, check that the command syntax is entered correctly by typing at without command-line options. If the information displayed in the Command Line column is incorrect, delete the command, and then retype it. If it is not correct, you can retype the command with fewer command-line options.
View the result
Run as a daemon using at's planned commands. The results of the run are not displayed on the computer. To redirect output to a file, use the redirect symbol (>). If you redirect output to a file, whether you use at on the command line or in a batch file, you need to use the escape character (^) before the redirect symbol. For example, to redirect output to an Output.text file, type:
At 14:45 c:\ test.bat ^ > c:\ output.txt
The current directory where the command is executed is the systemroot folder.
Change the system time
After using the at command to schedule the command to run, if you change the computer's system time, you can synchronize the at scheduler with the modified system time by typing at without a command line option.
Storage command
Scheduled commands are stored in the registry. In this way, if you restart the schedule service, you will not lose the scheduled task.
Connect to a network drive
Do not use redirected drives for scheduled jobs that require access to the network. The schedule service may not be able to access these redirected drives, or if other users log in while the scheduled task is running, these redirected drives may not appear. Therefore, for scheduled jobs, use the UNC path. For example:
At 1:00pm my_backup\\ server\ share
Please do not use the following syntax (where x:? Represents a connection established by a user):
At 1:00pm my_backup x:
If you plan an at command that uses a drive letter to connect to the shared directory, include an at command to disconnect from the drive when you finish using the drive. If you cannot disconnect the drive, the assigned drive letter will not be available at the command prompt.
Example
To display a list of scheduled commands on the Marketing server, type:
At\\ marketing
To learn more about the command with identification number 3 on the server Corp, type:
At\\ corp 3
"to plan to run the network share command on the Corp server at 8:00 and redirect the list to the Corp.txt file (located in the Reports shared directory) on the Maintenance server, 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 a batch program called Archive.cmd (which contains the backup command), and then schedule the batch program to run, type:
At\\ marketing 00:00 / every:5,10,15,20,25,30 archive
To cancel all scheduled commands on the current server, clear the at schedule information as follows:
At / delete
If the command you want to run is not an executable (.exe) file, use cmd / c to load Cmd.exe before the command as shown below:
Cmd / c dir > c:\ test.out.
This is the end of this article on "how to use at commands in dos". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.