windows 如何在一段时间内重复运行批处理文件:调度任务
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3958896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to run a batch file over a period of time repeatedly : Scheduling a task
提问by Rites
I've a task(.bat file) which should be performed/executed after every 15mins.
我有一个任务(.bat 文件),应该在每 15 分钟后执行/执行一次。
I don't know where to make its entry so that it'll be scheduled?
我不知道在哪里输入以便安排它?
With this, I want to see the execution(progress) of the task running(in command prompt).
有了这个,我想查看正在运行的任务的执行(进度)(在命令提示符中)。
回答by ghostdog74
take a look at schtasks
command to set task on the command line
看一看在schtasks
命令行上设置任务的命令
C:\test>schtasks /?
回答by Colin Pickard
The Task Scheduleris an easy way to do this manually.
该任务计划程序是一个简单的方法来此做手工。
If you need to script it, look at the at
command.
如果需要编写脚本,请查看at
命令。
回答by Vantomex
Quoted from a Microsoft Technet article, Schtasks:
引自 Microsoft Technet 文章Schtasks:
; To schedule a task that runs every 20 minutes
;
; The following command schedules a security script, Sec.vbs,
; to run every 20 minutes. The ; command uses the /sc parameter
; to specify a minute schedule and the /mo parameter to specify
; an interval of 20 minutes.
; Because the command does not include a starting date or time,
; the task starts 20 minutes after the command completes, and
; runs every 20 minutes thereafter whenever the system is running.
; Notice that the security script source file is located on a
; remote computer, but that the task is scheduled and executes
; on the local computer.
schtasks /create /sc minute /mo 20 /tn "Security Script" /tr \central\data\scripts\sec.vbs
You can find more explanations and examples in the reference mentioned above.
您可以在上述参考资料中找到更多解释和示例。