How to schedule a windows task to repeat every day within a time range?

7

1

In Windows 7, how to schedule a task which repeats every hour, every day but within a time range. I have a script which needs to run everyday from 08:00 to 20:00 in 1 hour interval.Could not find any solution even after googling.Anybody tried something similar? Any hints?

Arun Mohan

Posted 2011-10-11T13:11:12.683

Reputation: 73

Answers

10

The Task Scheduler does this all by itself... When you add a trigger to tell the task when to run, it's available as an advanced option.

Trigger Options

afrazier

Posted 2011-10-11T13:11:12.683

Reputation: 21 316

3

The 12 hour duration each day is supported in the UI, for others you need to use the command line. You set the recur to daily and the repeat + duration for how often and for how long you want the tasks to run during that day.

enter image description here

The trigger summary ends up as:

enter image description here

Brian

Posted 2011-10-11T13:11:12.683

Reputation: 8 439

The 12 hour duration each day is supported in the UI, for others you need to use the command line. any simple using *command line* for 20 hours duration each day, one execution each hour? – Kiquenet – 2018-10-02T13:31:47.483

3No need to use the command line, just type 7 hours (or whatever you need) in for the duration (or repeat every field). – afrazier – 2011-10-11T14:44:59.520

I can't get these settings to work. The task runs after the 12:th iteration until the next day. I have the same exact settings but I'm running Windows 2008 server. Any ideas? – Adam Asham – 2012-10-16T10:01:10.277

2

You could look into the "schtask" command on the command promt (if you type help on command prompt you will see it listed). Assuming I understand your question correctly, this is what you want to type:

schtasks /create /tn (whatever Task Name you want to call it) /tr (location full of the file) /sc hourly /st 08:00:00 /et 20:00:00 /sd (start date that you want mm/dd/yyyy)

W2Zk

Posted 2011-10-11T13:11:12.683

Reputation: 21

0

Have you looked into using Windows Scheduled Tasks?

dmux

Posted 2011-10-11T13:11:12.683

Reputation: 61