Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file schtasks/create(有一个每天运行、每小时重复的任务_Batch File_Scheduled Tasks_Windows Task Scheduler - Fatal编程技术网

Batch file schtasks/create(有一个每天运行、每小时重复的任务

Batch file schtasks/create(有一个每天运行、每小时重复的任务,batch-file,scheduled-tasks,windows-task-scheduler,Batch File,Scheduled Tasks,Windows Task Scheduler,很抱歉,如果有人问这个或类似的问题,我希望我遗漏了一些愚蠢的东西,这很简单,但是。如何使用schtasks/create命令创建任务,该命令将从每天7点开始,并无限期或持续一天,每小时重复一次 如果我这样做 schtasks /create /tn "test" /tr "\"C:\Program Files\test.exe"" /sc HOURLY /mo 1 schtasks /create /tn "test" /tr "\"C:\Program Files\test.exe"" /s

很抱歉,如果有人问这个或类似的问题,我希望我遗漏了一些愚蠢的东西,这很简单,但是。如何使用
schtasks/create
命令创建任务,该命令将从每天7点开始,并无限期或持续一天,每小时重复一次

如果我这样做

schtasks /create /tn "test" /tr "\"C:\Program Files\test.exe"" /sc HOURLY /mo 1
schtasks /create /tn "test" /tr "\"C:\Program Files\test.exe"" /sc DAILY /mo 1
仅当达到指定的日期和时间时才会触发

如果我这样做

schtasks /create /tn "test" /tr "\"C:\Program Files\test.exe"" /sc HOURLY /mo 1
schtasks /create /tn "test" /tr "\"C:\Program Files\test.exe"" /sc DAILY /mo 1
它一天只会触发一次


提前感谢!

Windows 8.1的帮助中有此示例。还有一个
小时开关

==> Creates a scheduled task "accountant" on the remote machine
    "ABC" to run calc.exe every five minutes from the specified
    start time to end time between the start date and end date.

    SCHTASKS /Create /S ABC /U domain\user /P password /SC MINUTE
             /MO 5 /TN accountant /TR calc.exe /ST 12:00 /ET 14:00
             /SD 06/06/2006 /ED 06/06/2006 /RU runasuser /RP userpassword

我明白了,重复间隔和持续时间基本上是我所需要的

下面是如何安排每天7:00每1小时运行一次,持续1天

schtasks /create /tn "test" /tr "\"test.exe"" /sc DAILY /st 07:00 /f /RI 60 /du 24:00

批处理文件本身可以使用
timeout
延迟60分钟,然后再次循环启动。计划的任务可以在早上7点启动批处理文件。嗯,这可能是一种黑客攻击的方式,但是如果计算机在7点未打开或7点后关闭,它将无法启动批处理文件或重新启动批处理文件e、 …然而,我如何才能做到每天如此?(不仅仅是在开始日期和结束日期之间)