---
title: "Setting up a Cron for Windows Using the Task Scheduler"
description: "Learn how the equivalent of Cron for Windows, Task Scheduler, works to keep everything on time and running smoothly!"
canonical: "https://adamtheautomator.com/cron-for-windows/"
---

# Setting up a Cron for Windows Using the Task Scheduler

> Learn how the equivalent of Cron for Windows, Task Scheduler, works to keep everything on time and running smoothly!

Source: https://adamtheautomator.com/cron-for-windows/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Setting up a Cron Job for Windows Using the Task Scheduler](https://adamtheautomator.com/wp-content/uploads/2023/08/cron-for-windows.jpg)

# Setting up a Cron Job for Windows Using the Task Scheduler

[![](https://secure.gravatar.com/avatar/2788bb1a3f735603f81eca51d68daec56a9d97e805a10268fb2c20afcc76b81b?s=192&d=mm&r=g)Nicholas Xuan Nguyen](https://adamtheautomator.com/author/nicholas-xuan-nguyen/)24 August 20235 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Windows](/tag/windows/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Creating and Configuring a Cron Job for Windows](#creating-and-configuring-a-cron-job-for-windows)
*   [Running Cron Jobs Manually](#running-cron-jobs-manually)
*   [Modifying Existing Cron for Windows Jobs](#modifying-existing-cron-for-windows-jobs)
*   [Deleting Obsolete and Unneeded Cron Jobs](#deleting-obsolete-and-unneeded-cron-jobs)
*   [Conclusion](#conclusion)

Streamlining tasks through automated processes is an effective way to enhance efficiency and reduce your workload. How? Setting up a cron for Windows jobs is one way to achieve this type of automation.

In this tutorial, you will learn how to set up and run cron jobs on Windows via its own Task Scheduler.

Keep reading and level up your productivity!

## Prerequisites

This tutorial houses hands-on demonstrations. If you wish to follow along, ensure you have a system that supports Windows (Windows 7 or newer) in place — this tutorial uses [Windows 11](https://adamtheautomator.com/windows-11-linux/).

Related:[Leveraging a Windows 11 Linux Host as an IT Administrator](https://adamtheautomator.com/windows-11-linux/)

## Creating and Configuring a Cron Job for Windows

A cron job, or cron task, is a time-based job scheduler in Unix-like OSes. Instead of manually running tasks on repeat, this scheduler allows you to automate task executions or scripts at specific intervals. Those intervals can be minutes, hours, days, weeks, or months.

Related:[How To Execute and List Cron Jobs for a Linux System via PHP.](https://adamtheautomator.com/list-cron-jobs/)

Moreover, cron jobs are typically repetitive and require minimal user interaction, saving time and effort. Similarly, you can set up a cron job in Windows using the Task Scheduler.

To create a cron job for Windows via the Task Scheduler, follow these steps:

1\. Launch the Task Scheduler from the Start menu, or type _**taskschd.msc**_ in the Run dialog and press Enter.

2\. Once the Task Scheduler opens, click **Create Task** under the **Actions** (right pane) to initiate the task creation process.

![cron for windows - Initiating the task creation process](https://adamtheautomator.com/wp-content/uploads/2023/08/image-224.png)

Initiating the task creation process

3\. Next, configure the following **General** settings in the **Create Task** window.

*   **Name** – Provide a descriptive name for your cron job (i.e., **myfirstcronjob**).
*   **Configure for** – Select your Windows version (i.e., **Windows 10)** from the drop-down field.
*   Keep other settings on defaults, as these are unnecessary for this tutorial.

![Setting a cron job name and selecting the Windows version](https://adamtheautomator.com/wp-content/uploads/2023/08/image-223.png)

Setting a cron job name and selecting the Windows version

4\. Now, navigate to the **Trigger** tab and click **New** to set up the schedule for when your cron job should run.

![Initiating adding a new trigger for running the cron job](https://adamtheautomator.com/wp-content/uploads/2023/08/image-222.png)

Initiating adding a new trigger for running the cron job

5\. On the New Trigger window, configure the trigger for the cron job with the following:

*   **Begin the task** – Select a trigger for the cron job in the drop-down field. The **On a schedule** option lets you set a date and time to run the cron job automatically.
*   **Settings** – Set a frequency (i.e., **Daily**) and **Start** date and time to run your cron job.
*   Tick the **Enabled** box to enable the trigger.

Notice that you can set up various triggers, which allows you to control the frequency and timing of the task execution. But in this example, the cron job is set to run **Daily** starting on **24/08/2023**.

Once configured, click **OK** to save the trigger changes.

![Select the frequency and interval for the cron job’s trigger](https://adamtheautomator.com/wp-content/uploads/2023/08/image-221.png)

Select the frequency and interval for the cron job’s trigger

6\. Navigate to the **Action** tab and click **New** to specify the action your cron job will perform when triggered.

![Initiating adding an action for the cron job to perform](https://adamtheautomator.com/wp-content/uploads/2023/08/image-220.png)

Initiating adding an action for the cron job to perform

7\. Create a file called _HelloWorld.ps1_ (arbitrary), populate the code below to the file, and save it on your local computer.

Related:[How to Edit Files with a Real PowerShell Text Editor](https://adamtheautomator.com/powershell-text-editor/)

The following code, when executed, displays a message (`Write-Host`) and terminates the script automatically after one second (`-Seconds 1`) post-countdown.

```powershell
# Define a counter value (three seconds)
$counter = 3
# Define a loop that runs while the counter value is greater than zero (0)
while ($counter -gt 0) {
    # Prints a message
    Write-Host "Hello, World! Closing in $counter seconds..."
    # Wait one second
    Start-Sleep -Seconds 1
    # Decreases counter value by 1
    $counter--
}
# Prints another message when the counter value reaches zero (0)
Write-Host "Closing now!"
# Wait another second before terminating the script
Start-Sleep -Seconds 1
```

Related:[Understanding the PowerShell Write-Host Cmdlet](https://adamtheautomator.com/powershell-write-host/)

Related:[The PowerShell While Loop : A Back to Basic Guide](https://adamtheautomator.com/powershell-while-loop/)

8\. Switch back to the **New Action** window and configure the actions your cron job will take when triggered as follows:

*   Action – Select Start a program from the drop-down field to run a program or script when your cron job is triggered.
    
*   Program/script – Input powershell in the empty field, which tells your system to run a PowerShell program/script whenever your cron job triggers.
    

Related:[How to Run a PowerShell Script From the Command Line and More](https://adamtheautomator.com/run-powershell-script/)

*   Add arguments (optional) – Type in -File <ps1>, replacing <ps1> with your PowerShell script file’s full path (i.e., _C:\\PowerShellScripts\\HelloWorld.ps1_).
    
    Arguments provide additional information and parameters to the action being performed. These can modify the behavior of the script or program being executed.
    

With the action configured, click **OK** to confirm your selected settings.

![Configuring a new action](https://adamtheautomator.com/wp-content/uploads/2023/08/image-219.png)

Configuring a new action

9\. Click **OK** when you are happy with your selected settings to save your cron job or task.

![Saving the cron job](https://adamtheautomator.com/wp-content/uploads/2023/08/image-218.png)

Saving the cron job

10\. Lastly, click **Task Scheduler** **Library** (left pane) on the main screen of the Task Scheduler, and you will see your newly configured cron job listed among others.

This library is a central location to manage all scheduled cron jobs on your system.

> 💡 _If your newly created cron job is not found in the list, click **Refresh** (right-pane) to refresh the list of jobs in the Task Scheduler Library._

![Verifying the newly created cron job](https://adamtheautomator.com/wp-content/uploads/2023/08/image-217.png)

Verifying the newly created cron job

## Running Cron Jobs Manually

After successfully creating and configuring a cron job, how do you know it works? Instead of letting it run on schedule, testing the execution of a cron job is a crucial step to verify its functionality and ensure it works as intended.

To manually run your cron job:

Select your newly configured cron job from the list, and click **Run** under the **Action** section (right pane). As specified in your cron job, the PowerShell script runs, and an output displays on a PowerShell console.

If everything looks good as below, you can rely on this cron job to run automatically based on the schedule you configured.

![Running the cron job manually](https://adamtheautomator.com/wp-content/uploads/2023/08/image-1.gif)

Running the cron job manually

## Modifying Existing Cron for Windows Jobs

Imagine, after running your cron job, you noticed something off. Can you fix it? Yes! You can modify existing cron jobs in Task Scheduler at any time. Since the needs of your system or workflow typically evolve, the task executed by the Cron job needs to be adjusted.

To make changes to an existing cron job, follow these steps:

Look for and select the specific job you wish to modify, and click **Properties** (right pane) to access the cron job’s properties.

![Accessing a cron job’s properties](https://adamtheautomator.com/wp-content/uploads/2023/08/image-225.png)

Accessing a cron job’s properties

Now, adjust various parameters in the cron job’s **Properties** window, and click **OK** to save the changes.

![Modifying a cron job](https://adamtheautomator.com/wp-content/uploads/2023/08/image-226.png)

Modifying a cron job

## Deleting Obsolete and Unneeded Cron Jobs

Similar to Unix-like systems, Windows can accumulate numerous scheduled tasks. Deleting redundant or obsolete tasks can help optimize system performance and resource utilization.

To delete obsolete and unneeded cron jobs:

Select a cron job from the list, and click **Delete** (right pane) to delete the selected job.

![Deleting a cron job](https://adamtheautomator.com/wp-content/uploads/2023/08/image-228.png)

Deleting a cron job

When prompted, click **OK**, as shown below, to confirm deleting the cron job.

![Confirming cron job deletion](https://adamtheautomator.com/wp-content/uploads/2023/08/image-227.png)

Confirming cron job deletion

## Conclusion

In a world where time is a limited and valuable resource, leveraging the capabilities of automation is an investment that can yield significant returns. Through this tutorial, you have learned to establish cron jobs for Windows using the Task Scheduler.

Accordingly, you can now orchestrate the execution of mundane and/or repetitive tasks in a timely fashion. Reclaim and dedicate valuable time to more important endeavors with this newfound knowledge!

Why not up your productivity game further and explore the concept of [automating tasks with PowerShell](https://learn.microsoft.com/en-us/power-platform/admin/wp-task-automation-powershell)? Start automating various system admin tasks ranging from simple jobs, like reporting disk space usage, to more complex ones, such as deploying a new web server.

Related:[Supercharge Selenium and PowerShell for Web Automation](https://adamtheautomator.com/selenium-and-powershell/)

Dive into the world of automation; your future self will thank you for it!

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fcron-for-windows%2F&text=Setting%20up%20a%20Cron%20Job%20for%20Windows%20Using%20the%20Task%20Scheduler)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fcron-for-windows%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fcron-for-windows%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/publisher/3ec5d9c85b2b81d9ab7cd5dbb6caf044/21b786d67f19d1813150edf9871e36ead78714b63880de8c6161c7fde11a9769.webp)

### [Pktmon: Capture Windows Traffic Without a Third-Party Driver](/pktmon-capture-windows-traffic/)

Use the in-box Windows Pktmon tool to capture packets and packet-drop reasons, then convert the ETL to pcapng and text for offline analysis.

![](https://adamtheautomator.com/wp-content/uploads/2024/04/idfix.jpg)

### [Solve Azure AD Connect Errors via the Microsoft IdFix Tool](/idfix/)

Fix Azure AD Connect errors fast with the Microsoft IdFix tool—your go-to solution for seamless synchronization and efficient directory management!

![](https://adamtheautomator.com/wp-content/uploads/2024/04/sandboxie.jpg)

### [How to Install Sandboxie on Windows](/sandboxie/)

Secure your Windows system with Sandboxie. Learn how to install this tool hassle-free and safeguard your digital activities!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
