Back to Blog
Platform8 min read

Windows Task Scheduler vs Cron: Complete Guide for Developers

If you work on Windows and need to schedule tasks, Windows Task Scheduler is the built-in equivalent of Unix cron. This guide covers both tools, shows you how to create scheduled tasks with the GUI, CLI, and PowerShell, and explains when a cross-platform alternative makes more sense.

What Is Windows Task Scheduler?

Windows Task Scheduler is a built-in Windows service that lets you run programs, scripts, or commands on a schedule or in response to system events. It has been included in every version of Windows since Windows 95 (as “Scheduled Tasks”) and was significantly upgraded in Windows Vista with the Task Scheduler 2.0 API.

Where Unix systems use the cron daemon with a text-based cron expression format, Task Scheduler uses a triggers + actions model. A trigger defineswhen a task runs (time-based, event-based, at logon, at startup), and an action defines what runs (a program, a script, an email, or a message).

You can manage Task Scheduler three ways: the GUI (taskschd.msc), the command-line tool (schtasks), or PowerShell cmdlets. The underlying service is called Schedule and runs automatically on every Windows machine.

Task Scheduler vs Unix Cron

Here is a side-by-side comparison of the two most common scheduling tools across operating systems:

FeatureWindows Task SchedulerUnix Cron
GUIYes (taskschd.msc)No (text-based only)
CLI toolschtaskscrontab
Config formatXMLCron expression (5 fields)
Minimum interval1 minute1 minute
Trigger typesTime, event, logon, startup, idle, lock/unlockTime-based only
ConditionsIdle, AC power, network availableNone built-in
Service nameSchedulecrond / cron
Log locationEvent Viewer (TaskScheduler log)/var/log/cron or syslog
Run missed tasksYes (“Run as soon as possible”)anacron only
Built-in retryYes (restart on failure)No

Creating a Scheduled Task (GUI)

The graphical interface is the fastest way to create a one-off task:

  1. Press Win + R, type taskschd.msc, and press Enter.
  2. In the right panel, click Create Basic Task (wizard) or Create Task (full options).
  3. Enter a Name and optional Description.
  4. On the Trigger tab, choose when the task runs (daily, weekly, at logon, at startup, etc.).
  5. On the Action tab, select Start a program and browse to your script or executable.
  6. On the Conditions tab, optionally set requirements like “only start if the computer is on AC power.”
  7. On the Settings tab, enable “Run task as soon as possible after a scheduled start is missed” and configure retry behavior.
  8. Click OK. If prompted, enter the user credentials under which the task will run.

For tasks that should run when no user is logged in, select “Run whether user is logged on or not” on the General tab. This is the most common source of “my task does not run” issues.

Creating a Scheduled Task (CLI)

The schtasks command is available on every Windows installation. Here are the most common patterns:

Daily at 9 AM

schtasks /create /tn "DailyBackup" /tr "C:\scripts\backup.bat" /sc daily /st 09:00

Every 5 minutes

schtasks /create /tn "HealthCheck" /tr "C:\scripts\check.bat" /sc minute /mo 5

The cron equivalent would be */5 * * * *.

Weekly on Monday at 8 AM

schtasks /create /tn "WeeklyReport" /tr "C:\scripts\report.bat" /sc weekly /d MON /st 08:00

At user logon

schtasks /create /tn "StartupSync" /tr "C:\scripts\sync.bat" /sc onlogon

At system startup

schtasks /create /tn "BootCleanup" /tr "C:\scripts\cleanup.bat" /sc onstart /ru SYSTEM

The /ru SYSTEM flag runs the task as the SYSTEM account, which does not require a password prompt.

PowerShell Scheduled Tasks

PowerShell provides more control than schtasks. The key cmdlets are New-ScheduledTaskTrigger, New-ScheduledTaskAction, and Register-ScheduledTask.

Run a Python script daily at 6 AM

$trigger = New-ScheduledTaskTrigger -Daily -At 6am
$action  = New-ScheduledTaskAction -Execute "python.exe" -Argument "C:\scripts\etl.py"
Register-ScheduledTask -TaskName "DailyETL" -Trigger $trigger -Action $action -Description "Run ETL pipeline"

Run every 15 minutes with repetition

$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 15) -RepetitionDuration (New-TimeSpan -Days 365)
$action  = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-File C:\scripts\monitor.ps1"
Register-ScheduledTask -TaskName "Monitor15m" -Trigger $trigger -Action $action -RunLevel Highest

Call a webhook URL

$trigger = New-ScheduledTaskTrigger -Daily -At 2am
$action  = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-Command Invoke-RestMethod -Uri https://api.example.com/cron/nightly -Method POST"
Register-ScheduledTask -TaskName "NightlyWebhook" -Trigger $trigger -Action $action

Viewing and Managing Tasks

Use schtasks to query, modify, run, and delete tasks from the command line:

List all tasks

schtasks /query /fo TABLE /nh

Get details for a specific task

schtasks /query /tn "DailyBackup" /v /fo LIST

Run a task immediately

schtasks /run /tn "DailyBackup"

Change the schedule

schtasks /change /tn "DailyBackup" /st 10:00

Delete a task

schtasks /delete /tn "DailyBackup" /f

PowerShell equivalents

# List all tasks
Get-ScheduledTask

# Get task info
Get-ScheduledTaskInfo -TaskName "DailyBackup"

# Run now
Start-ScheduledTask -TaskName "DailyBackup"

# Disable
Disable-ScheduledTask -TaskName "DailyBackup"

# Remove
Unregister-ScheduledTask -TaskName "DailyBackup" -Confirm:$false

Task Scheduler Limitations

Task Scheduler works well for local, single-machine automation. But it has significant gaps for production workloads:

  • No monitoring dashboard. You have to check Event Viewer manually or build your own log parsing.
  • No alerting. If a task fails at 3 AM, nobody knows until someone checks.
  • No retry logic. Tasks can restart on failure, but there is no exponential backoff or configurable retry count for the action itself.
  • Single machine only. Tasks are tied to the Windows machine where they are created. No centralized management across servers.
  • No team visibility. There is no shared interface for teams to see what is scheduled and when it last ran.
  • Credential management. Tasks running as a specific user break when that user's password changes.

These same limitations apply to Unix cron. Both tools were designed for local scheduling, not for coordinating tasks across distributed systems. See also: Cron Job Not Running? Troubleshooting Guide.

Cross-Platform Alternative: CronJobPro

If you need scheduled tasks that work the same way regardless of whether your servers run Windows, Linux, or macOS, an HTTP-based scheduling service eliminates the platform-specific tooling entirely.

CronJobPro lets you define schedules using familiar cron expressions and triggers HTTP requests to your endpoints on schedule. It works from any OS because the scheduling runs on our infrastructure, not on your local machine.

  • Works from any OS — Windows, Linux, macOS, containers, serverless
  • Built-in monitoring — see every execution, response time, and status code
  • Automatic retries — configurable retry count with exponential backoff
  • Alerts — email and webhook notifications on failure
  • Team dashboard — shared visibility into all scheduled tasks
  • Standard cron syntax — no need to learn schtasks or PowerShell cmdlets

This is especially useful for database backups, health checks, and any task that needs to run whether or not a specific machine is online.

Common Patterns

Run a Python script on schedule

schtasks /create /tn "PythonETL" /tr "python C:\projects\etl\main.py" /sc daily /st 06:00

Run a PowerShell script

schtasks /create /tn "PSCleanup" /tr "powershell.exe -ExecutionPolicy Bypass -File C:\scripts\cleanup.ps1" /sc daily /st 02:00

Call a REST API

schtasks /create /tn "APICall" /tr "powershell.exe -Command \"Invoke-RestMethod -Uri https://api.example.com/trigger -Method POST\"" /sc hourly

Database backup with sqlcmd

schtasks /create /tn "SQLBackup" /tr "sqlcmd -S localhost -Q \"BACKUP DATABASE MyDB TO DISK='C:\backups\mydb.bak'\"" /sc daily /st 01:00 /ru SYSTEM

Troubleshooting

Task does not run

The most common cause: the task is set to “Run only when user is logged on”. Change it to “Run whether user is logged on or not” in the General tab, then re-enter the user credentials.

Last run result: 0x1

Error code 0x1 usually means the program returned a non-zero exit code. Check that the path to your script is correct and that it runs successfully when executed manually. Wrap your command in a batch file that logs output to narrow down the issue.

Task runs but script does nothing

Set the “Start in” (working directory) field in the Action tab. Without it, the script runs from C:\Windows\System32, which can cause relative path issues. In schtasks, this is the /sd parameter or set it via the XML export.

Permission issues

If the task needs elevated privileges, check “Run with highest privileges” on the General tab. For tasks that access network resources, make sure the user account has the “Log on as a batch job” right in Local Security Policy.

Check the event log

# PowerShell: view recent Task Scheduler events
Get-WinEvent -LogName "Microsoft-Windows-TaskScheduler/Operational" -MaxEvents 20 | Format-Table TimeCreated, Id, Message -Wrap

FAQ

Can I use cron syntax on Windows?

Not natively. Windows does not understand cron expressions. However, you can install WSL (Windows Subsystem for Linux) and use a real cron daemon, or use a cloud-based service like CronJobPro that accepts standard cron syntax and triggers your tasks over HTTP.

How do I run cron in WSL?

In WSL 2, run sudo service cron start and then crontab -e to edit your schedule. Note that cron does not auto-start in WSL — you need to start it each session or add the start command to your shell profile.

Where are Task Scheduler logs?

Open Event Viewer and navigate to Applications and Services Logs > Microsoft > Windows > TaskScheduler > Operational. If the log is disabled, right-click it and select “Enable Log.” For Unix cron logs, see Where Are Cron Logs Stored?

Can Task Scheduler run tasks when the computer is off?

No. Task Scheduler only runs on a powered-on Windows machine. If the machine is off during a scheduled time, you can enable “Run task as soon as possible after a scheduled start is missed” so it runs when the machine next boots. For tasks that must execute regardless of machine state, use a cloud-based scheduler.

What is the difference between schtasks and PowerShell scheduled task cmdlets?

Both create the same underlying Task Scheduler tasks. The schtasks command works in Command Prompt and is available on all Windows versions. PowerShell cmdlets (*-ScheduledTask*) offer richer parameter support, pipeline integration, and are easier to use in scripts. Use whichever fits your workflow.

Related Articles

Schedule tasks from any OS — no local setup needed

CronJobPro uses standard cron syntax to trigger HTTP requests on schedule. Works on Windows, Linux, macOS, and containers — with monitoring, retries, and alerts built in. Free for up to 5 jobs.