How to setup a cron job in Windows?

Better Stack Team
Updated on October 5, 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:

🔭 Want to get alerted when your Cron doesn’t run correctly?

Go to Better Stack and start monitoring in 5 minutes.

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.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github