Windows Task Scheduler

Creating a Windows Scheduler to Run Programs Automatically

With the help of theĀ Task Scheduler, you can create all kinds of automated tasks or programs to be run by Windows. For example, you can schedule some apps to run at specific time intervals or display a message on your desktop when something happens. You can also run a script or batch file that you created at a specific time interval, at windows start up, or other conditions. Unfortunately, not many people know about this tool, as Windows does not advertise it as much as it deserves. To help you get started working with it, I created this guide on how to use the basic task wizard offered by the Task Scheduler. This application is already built in every windows version, so you don’t have to worry about finding the installer of the app. It’s already in your computer. Here is how it work :

Opening Windows Task Scheduler

To open Windows Task Scheduler application, simply click on Windows logo button on your keyboard and type ‘Task Scheduler’. Click on the Task Scheduler app to open it.

How to open Windows Task Scheduler


Creating a Windows Task Scheduler to Run Programs Automatically

  1. Start the “Create Task” wizard
    Windows Task Scheduler Create Task

  2. On General Tab, name your first scheduler.
    Windows Scheduler General Tab

    • To make the scheduler run only when user is logged on, choose ‘Run only when user is logged on’. Please note that by selecting this option, whenever the user logged off windows, the scheduler will not run even if scheduled in future time.
    • To make the scheduler run no matter the user is logged on or not, choose ‘Run whether user is logged on or not’. Windows will always run the task on schedule.

  3. Go to Triggers Tab, click New.
    Windows Task Scheduler Triggers Tab

  4. Configure your task to run on scheduled time. Select ‘On a schedule’ at the top of the window.
    Windows Task Scheduler Set Triggers

    • You can choose whether the scheduler will run one time only, daily, weekly, or monthly. After selecting this option, you need to select the start time on the right.
    • On Advanced settings section, you can configure :
      • Delay time, this allows the scheduler to run after specific time of the delay after the scheduled start time.
      • Repeat task, this allows the scheduler to repeat every day, hour, minute, or every few seconds. You can set this to repeat for indefinite time.
      • Stop task if runs longer than time specified.
      • Expiry time.

  5. Now it’s time to tell Windows Task Scheduler what to do. Open ‘Actions’ tab, then click ‘New’ button.
    Task Scheduler Action Tab 1

  6. Choose ‘Start a program’, click on ‘Browse’. You may choose any files to run automatically. In this example, I want to run a php file in my htdocs folder, called index.php. So I typed :
    • Program/ script :
      D:\xampp\php\php.exe
    • Add arguments :
      -f D:\xampp\htdocs\longpolling\index.php

      Task Scheduler Action Tab
      Remember that this is just an example. Basically you can run any files, like a batch file, a program that you created, or any third party applications in your computer.

  7. After specifying the application to run automatically, basically we are done. To test the scheduler, you can set the trigger to run a few minutes forward.
    To check the created scheduler, click Task Scheduler Library on the left sidebar, then find the scheduler name on the middle panel.
    Windows Task Scheduler Library
    You can run the scheduler manually by doing right click on the scheduler name, then click run. But you need to understand that this action will only run the task once, and will not repeat as told in the triggers option. To make the scheduler run continuously based on triggers option, you need to set the trigger start time on step 4 to a future time, for example a minute forward.

So that’s it about how to create a Windows Task Scheduler. There are a lot of things we can do with this feature. One of them is to create a long polling Telegram bot. In long polling, you need to continuously check to telegram server whether there is someone sending a message to the bot or not. For detailed explanation about how to create a Telegram bot using long polling method, you can check this post : Creating Telegram Bot using PHP : Long Polling.

Leave a Reply

Your email address will not be published. Required fields are marked *