Task scheduler - Condition on time of day

Benjamin J 21 Reputation points
2021-05-04T11:46:14.723+00:00

I want to set a task to run on log on, but only if the time lies in a predefined range, e.g. between 08:00 and 20:00.

Is there a way to do this with task scheduler?

If not, what would be the recommended alternative? Interpose a powershell script and check the time in that?

Background:
I want to set the sound output device (using NirCmd) depending on the time.
The task is triggered at 08:00 and that works, but if I log on at e.g. 09:00, I want it to trigger also then.

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

Accepted answer
  1. Reza-Ameri 17,336 Reputation points Volunteer Moderator
    2021-05-04T14:47:31.62+00:00

    If you right click on the task and click on Properties then in this menu go to Settings and check the box **Run task as soon as possible after a scheduled start is missed ** and it will perform the task as soon as you start your system and the time have been missed.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Carl Fan 6,881 Reputation points
    2021-05-05T09:37:19.45+00:00

    Hi,
    Open Task Scheduler.
    Create task
    Triggers tab
    New ...
    Use the following settings
    You don't need to stick with the pre-defined times - you can type into these fields any value you wish.
    93932-capture2.png

    In "for a duration of" you could enter the amount of minutes you want it to run for.
    Also you could select the options under Settings below:
    93952-capture3.png

    Hope this helps and please help to accept as Answer if the response is useful.
    Best Regards,
    Carl

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.