<img alt="" src="https://secure.leadforensics.com/150446.png " style="display:none;">
Go to top icon

Tutorial: Setting up Cron Job/Task scheduler in Windows

Archana Mulye Dec 31, 2015

Windows Technology

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:

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

Capture23.jpg

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.

Capture24.jpg

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.

Capture25.jpg

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:

Capture26.jpg

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.

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.