e-Zest members share technology ideas to foster digital transformation.

Tutorial: Setting up Cron Job/Task scheduler in Windows

Written by Archana Mulye | Dec 31, 2015 12:30:00 PM

Task scheduler or cron jobs are one of the most efficient ways to automatically make updates in systems or execute specific workflows within a particular application without manually executing programs.

The simplest way to create a task/cron job in windows is through the Task Scheduler Wizard. Start by clicking on the Start/Windows button. You can simply type ‘task’ in the search programs or files box and you will find the ‘Tasks Scheduler’. Click on it to proceed further.

An alternate way to do this is by starting with the Start/Windows button, going to Control Panel, clicking system and security, then Administrative Tools, and then double-clicking on Task Scheduler.‌ You might be asked to enter the password for confirmation.

The Task scheduler wizard will be seen as follows:

From ‘Actions’, click on ‘Create Task’. You will see the following screenshot:

In the ‘General’ tab, put ‘Cron’ or ‘Task’ Name, description and configure for option which should be set as per your windows version.

Then in the next tab, ‘Triggers’, click on ‘new’ so that a new window will appear where you can set up schedule for task as per your requirement.

Then with ‘Actions’ tab, you can set whether you want to run a program, send emails or set alert messages as reminder on screen.

In case you want to execute a windows batch file, you can click on Browse button and select a particular batch file which should be executed as per trigger set. Also, you can specify path for folder in the ‘Start In’ optional parameter. For example, if the batch file full path is ‘C:\test\task.bat’, you can put ‘C:\test’ as Start in value.

Conditions and Settings tabs are optional as they only have further options for scheduled cron or task. After all values are inserted, click on OK to save your changes.

You will see the scheduled cron or task in Task Scheduler library as follows:

Alternatively, you can also set Cron or Scheduled task in windows using command prompt:

schtasks /create /sc minute /mo 5 /tn "TaskName" /tr  C:\test\task.bat

This will execute task.bat file every 5 minutes.