【问题标题】:How to run a batch file over a period of time repeatedly : Scheduling a task如何在一段时间内重复运行批处理文件:调度任务
【发布时间】:2011-04-26 21:52:57
【问题描述】:

我有一个任务(.bat 文件),应该在每 15 分钟后执行/执行一次。

我不知道在哪里输入以便安排?

有了这个,我想查看正在运行的任务的执行(进度)(在命令提示符下)。

【问题讨论】:

    标签: windows batch-file scheduled-tasks


    【解决方案1】:

    引用自 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
    

    您可以在上面提到的参考中找到更多的解释和示例。

    【讨论】:

      【解决方案2】:

      看看schtasks命令在命令行设置任务

      C:\test>schtasks /?
      

      【讨论】:

      • + 1 schtasks 在大多数情况下优于 at,但请注意它在 Windows XP Home 或 XP 之前的任何版本中不可用。
      • 如何查看我的 .bat 文件的进度
      • 不明白。精心制作的。另外,编辑您的原始问题以包含此问题,详细说明
      • 我做到了。我只是想看看正在运行的任务的执行情况。
      【解决方案3】:

      Task Scheduler 是手动执行此操作的简单方法。

      如果您需要编写脚本,请查看 at 命令。

      【讨论】:

        猜你喜欢
        • 2011-06-21
        • 2014-12-16
        • 2015-09-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-03-01
        • 2016-10-31
        • 2014-09-14
        相关资源
        最近更新 更多