How to setup a cron job in Windows?

Better Stack Team
Updated on May 26, 2023

To set up a Cron job in Windows, you can use the Task Scheduler utility. Here are the steps to create and schedule a Cron job using Task Scheduler:

Open Task Scheduler

You can open Task Scheduler by typing "Task Scheduler" in the Start menu search bar and selecting the app from the search results.

cron_win_1.png

Create a new task

In the Task Scheduler window, click on the Create Task option in the Actions pane on the right.

cron_win_2.png

Configure the task settings

In the Create Task window, you can configure the following settings:

  • General: Enter a name and description for the task.
  • Triggers: Click on New to add a new trigger for the task. You can choose to run the task daily, weekly, monthly, or on a specific date and time.
  • Actions: Click on New to add a new action for the task. Select Start a program as the action type, and enter the path to the program you want to run in the Program/script field. For example, if you want to run a Python script, enter the path to the Python interpreter followed by the path to your script. For example, C:\Python\python.exe C:\path\to\script.py.
  • Conditions: Configure any additional conditions for the task, such as only running the task when the computer is idle.
  • Settings: Configure any additional settings for the task, such as whether to run the task even if the user is not logged in.

cron_win_3.png

Save the task

Click on OK to save the task and close the Create Task window.

Verify the task

You can verify that the task has been created by checking the Task Scheduler Library in the Task Scheduler window. You should see the task listed with the name and trigger you specified.

By following these steps, you can create and schedule a Cron job in Windows using the Task Scheduler utility.

Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

We are hiring.

Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.

Explore all positions →

Reliability is the
ultimate feature

Delightful observability tools that turn your logs & monitoring into a secret weapon for shipping better software faster.

Explore Better Stack