Linux have the same command for same reasons to schedule commands and jobs for specified times and periods. Windows have the same command with similar usage too. Alternative to this command is schtasks
command which will schedule future jobs too. We will look some usage examples of at
command.
由于相同的原因,Linux具有相同的命令,可以在指定的时间和周期内调度命令和作业。 Windows也具有相同用法的相同命令。 schtasks
命令可以替代此命令,该命令也将计划将来的作业。 我们将看一下at
命令的一些用法示例。
帮帮我 (Help)
Help about at command can be listed with /?
option.
关于at命令的帮助可以用/?
列出/?
选项。
$ at /?
安排工作(Schedule Job)
Jobs can be scheduled easily. We will specify the time and command with its parameters. In this example 11:00:00PM
is given as time and echo "hi"
is given as command and parameter.
可以轻松安排工作。 我们将使用其参数指定时间和命令。 在此示例中,11 11:00:00PM
被指定为时间,而echo "hi"
被指定为命令和参数。
$ at 11:00:00PM echo "hi"
安排定期工作(Schedule Recurrent Job)
We can create a a job which will run every given time or date period. In this example we create a job which will run defrag c:
command every Sunday
.
我们可以创建一个将在每个给定时间或日期周期运行的作业。 在此示例中,我们创建一个作业,该作业将在每个Sunday
运行defrag c:
命令。
$ at 10:00 /every:sunday defrag c:
列出计划的工作(List Scheduled Jobs)
There will be a lot of all ready scheduled jobs. We can list those jobs. We may list these jobs to learn their id and delete them. We will use at
command without any option to list existing jobs.
所有准备好的预定工作都会很多。 我们可以列出这些工作。 我们可能会列出这些作业以了解其ID并将其删除。 我们将使用at
命令,而没有任何选择来列出现有作业。
$ at
删除预定作业(Delete Scheduled Jobs)
All ready created jobs can be deleted with /delete
option and the id of the job. In this example we will delete job id 2 .
可以使用/delete
选项和作业ID /delete
所有已创建的作业。 在此示例中,我们将删除作业id 2。
$ at 2 /delete
翻译自: https://www.poftut.com/schedule-jobs-tasks-windows-command/