计算机任务计划程序在,使用任务计划程序每4小时运行一次脚本(run a script every 4 hours with task scheduler)...

使用任务计划程序每4小时运行一次脚本(run a script every 4 hours with task scheduler)

我有Windows 2008任务调度程序,我设置了一个PHP脚本来运行

C:\ php \ php.exe -f等...

在Windows任务计划程序中,我只能每天或每小时计划一次,我怎样才能将它配置为每4小时运行一次?

I have windows 2008 task scheduler I set up a PHP script to run like this

C:\php\php.exe -f etc...

In windows task scheduler I can only schedule daily or hourly how can I configure it to run every 4 hours?

原文:https://stackoverflow.com/questions/21240656

更新时间:2019-10-27 07:52

最满意答案

在Windows Server 2008 / 2008R2中,您可以将任务设置为重复所需的每个小时数,相应的下拉菜单仅提供一小时选项供您选择,但您可以键入任意数量的小时数(请参见下面的屏幕截图)。

LfR0u.png

In Windows Server 2008/2008R2 you can set task to repeat every number of hours you want, corresponding drop down menu just present you with 1 hour option to select, but you can type in any number of hours you need (see screenshot below).

LfR0u.png

相关问答

在Windows Server 2008 / 2008R2中,您可以将任务设置为重复所需的每个小时数,相应的下拉菜单仅提供一小时选项供您选择,但您可以键入任意数量的小时数(请参见下面的屏幕截图)。 In Windows Server 2008/2008R2 you can set task to repeat every number of hours you want, corresponding drop down menu just present you with 1 hour optio

...

你可以使用powershell脚本来做到这一点。 你可以执行一个程序,然后等到它完成它的taks,如下所示: While($True)

{

Start-Process $PythonPath -Wait

Start-Process $JavaPath -Wait

Start-Sleep -m 10

}

You could do that with a powershell script. You can execute a programm and then wait until it

...

您可以使用node-cron来安排增量作业 You could use node-cron to schedule an increment job

它表示由调度程序执行的作业运行所花费的时间的挂钟时间。 因此,举例来说,如果你每小时运行1分钟的工作,那么你每隔30天就要看720分钟的时间。 It means the wall clock time of the time taken for the jobs that are executed by scheduler to run. So, for instance, if you're running a 1 minute job every hour, you'd be looking

...

Azure PowerShell环境只需要了解默认情况下要使用的Azure订阅。 您可能已经为自己的环境执行了此操作,但任务计划程序在不同的环境中运行。 您只需在脚本的开头添加一个附加命令即可设置Azure订阅。 像这样的东西: Set-AzureSubscription -SubscriptionName 此命令的文档在此处 。 您也可以通过SubscriptionID等设置而不是SubscriptionName。 此外, 本文还介绍了如何将Azure订阅连接到PowerShell环境。 更新:

...

通常认为适当的空间计划任务,即使只有1分钟。 由于我不知道您的任务是否可以整合或优化,并且我不知道他们需要多长时间才能运行,所以我建议您在一个小时左右的时间内将它们排除在外。 备份有一些性能影响,这是他们通常在晚上完成的原因的一部分(当然,由于人们通常不工作,所以数据库上运行的事务更少),而且三个运行在同一时间...嗯,这不是我希望在我的数据库或我的用户。 回答最初的问题:调度程序可以同时运行很多事情:) It's usually considered proper to space out th

...

您是否尝试过使用文件的绝对路径? 我认为在任务调度程序中还有一个选项可以指定脚本应该运行的位置,您是否已将其设置为要写入的文件的位置? Have you tried using an absolute path to the file? I think there is also an option in task scheduler to specify where the script should be run, have you set that to the location of th

...

在Linux上: R CMD BATCH [options] my_script.R [outfile]

在Microsoft Windows上(根据需要调整R.exe的路径): "C:\Program Files\R\R-2.13.1\bin\R.exe" CMD BATCH

--vanilla --slave "c:\my projects\my_script.R"

从这里开始 。 On Linux: R CMD BATCH [options] my_script.R [outfi

...

您可以使用powershell脚本或批处理文件来执行schtasks ,它是任务计划程序的命令行界面。 然后,您只需运行脚本即可设置计划任务。 还有一个托管包装器 ,允许您在C#中创建计划任务,如果您希望采用这种方式。 You can use a powershell script or batch file to execute schtasks which is a command line interface to the task scheduler. Then you simply ne

...

我坚持下来,有趣的是,答案是这样的: "C:\Program Files\R\R-3.4.0\bin\R.exe" "C:\dataimport.R"

我不知道这个的原因,但只要它有效。 I kept at it and interestingly the answer to this was this: "C:\Program Files\R\R-3.4.0\bin\R.exe" "C:\dataimport.R"

I dont know the reason for this but as

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用 TaskScheduler.dll 库可以在你的 QT C++ 应用程序中创建 Windows 计划任务。以下是一些基本步骤: 1. 在你的 QT 项目中添加 TaskScheduler.h 和 TaskScheduler.lib 文件。 2. 在你的代码中包含 TaskScheduler.h 文件并链接 TaskScheduler.lib 库。 3. 创建 TaskScheduler 对象,这将允许你访问 Windows 计划任务。 ```cpp CoInitialize(NULL); // 初始化COM库 TaskScheduler scheduler; scheduler.Connect(); ``` 4. 创建一个任务计划并设置它的属性,如名称、描述、运行时间等。 ```cpp Task task(scheduler); task.SetApplicationName("C:\\myapp.exe"); task.SetParameters("/silent"); task.SetWorkingDirectory("C:\\"); task.SetComment("This is my task"); task.SetCreator("Me"); task.SetMaxRunTime(60000); // 任务最大运行时间为1分钟 ``` 5. 设置任务的触发器,以指定任务何时运行。 ```cpp Trigger trigger(task); trigger.SetStartBoundary("2021-08-01T10:00:00"); trigger.SetEndBoundary("2021-08-31T10:00:00"); trigger.SetInterval("PT1H"); // 每小时运行一次 ``` 6. 保存并注册任务计划,使其成为 Windows 计划任务。 ```cpp task.Save(); task.RegisterTaskDefinition("MyTask", NULL, TASK_CREATE_OR_UPDATE, "", "", TASK_LOGON_INTERACTIVE_TOKEN, ""); ``` 7. 最后,记得在程序结束时释放 TaskScheduler 对象。 ```cpp scheduler.Release(); CoUninitialize(); // 释放COM库 ``` 以上是一个基本的示例,你可以根据你的需求自定义任务的属性和触发器。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值