Windows Task Scheduler vs Cron
Windows has no built-in cron daemon — its native equivalent is Task Scheduler, a GUI-first (with a command-line and PowerShell API) tool with a fundamentally different configuration model: structured triggers and actions instead of a plain-text schedule string. Anyone moving a script between Linux and Windows needs to translate cron's compact syntax into Task Scheduler's trigger model.
Syntax Notes
Task Scheduler has no cron-string equivalent natively — schedules are defined as XML-backed "triggers" (Daily, Weekly, Monthly, On a schedule, At log on, At startup, etc.), each with its own set of fields, rather than one universal 5-field expression.
Examples
schtasks /create /tn "DailyBackup" /tr "C:\scripts\backup.bat" /sc daily /st 02:000 2 * * *$trigger = New-ScheduledTaskTrigger -Daily -At 2am
Register-ScheduledTask -TaskName "DailyBackup" -Trigger $trigger -Action (New-ScheduledTaskAction -Execute "C:\scripts\backup.bat")Gotchas
- Task Scheduler triggers don't map 1:1 onto every cron pattern — something like "every 15 minutes, weekdays only, 9 AM to 5 PM" (*/15 9-17 * * 1-5) requires a repeating trigger with a duration and a separate day-of-week condition, configured through multiple UI panels or several PowerShell/XML properties.
- By default, scheduled tasks only run when a specific user is logged on unless you explicitly configure 'Run whether user is logged on or not,' which also requires storing credentials — a common surprise for anyone assuming cron-like always-on behavior.
- Task history and triggers are stored in the Task Scheduler Library, not a single text file, making bulk review or version-controlling your schedule far more cumbersome than grepping a crontab file.
Best Practices
- Use `schtasks /create` or a PowerShell script for anything you want to reproduce reliably — treat the GUI as fine for one-off manual tasks but not for anything you need to check into source control.
- For genuinely cron-like scheduling on Windows (especially if you're porting Linux automation), consider running actual cron under WSL (Windows Subsystem for Linux) rather than translating every expression into Task Scheduler's trigger model.
- Always set 'Run with highest privileges' and the correct user account explicitly — silent permission failures are as common on Windows as PATH issues are on Linux cron.
Frequently Asked Questions
- Can I use cron syntax directly on Windows?
- Not with native Task Scheduler — it doesn't understand cron strings. You'd either translate manually, use a third-party tool that wraps Task Scheduler with cron syntax, or run actual cron inside WSL.
- Is there a cron daemon for Windows?
- Not built-in, but WSL (Windows Subsystem for Linux) lets you run a real Linux cron daemon on Windows 10/11, which is often the simplest path if you specifically need cron syntax rather than Task Scheduler's model.
- How do I express 'every 5 minutes' in Task Scheduler?
- Create a trigger set to repeat, with a repetition interval of 5 minutes and a duration (e.g., 1 day or indefinitely) — there's no direct equivalent to cron's compact */5 syntax in the UI, though the underlying XML task definition can express it precisely.
Related Tools
Platform Guides
Cron syntax for Linux, Kubernetes, AWS, and more
Kubernetes CronJob Guide
How to schedule recurring jobs in Kubernetes with CronJob resources: YAML manifest syntax, concurrency policy, and common gotchas.
GitHub Actions Cron Guide
Schedule GitHub Actions workflows with cron syntax: the schedule trigger, UTC-only timing, and why scheduled workflows can be delayed.