Skip to content

Task Scheduler ​

Task Scheduler is used to automate periodic tasks in WSL, avoiding repetitive manual maintenance. It provides a visual management interface, so you can create and manage scheduled tasks without memorizing complex command-line arguments.

Example use cases for this feature:

  • Periodically back up distributions in WSL
  • Run custom scripts or commands

All tasks are consolidated under the \WSLDashboard\UserTasks\ path of the Windows Task Scheduler for centralized viewing and management. You can see task status (Ready / Running / Disabled) in the interface in real time.

Community Script Repository ​

You can download example scripts (for backing up distributions) from the community repository below to get started quickly:

https://github.com/owu/wsl-community

This is a user-contributed code repository — you're welcome to submit Pull Requests to contribute scripts or share best practices.

Executing Commands ​

Command Configuration ​

Each scheduled task can be configured with a command to execute (a script or executable), supporting the following options:

SettingDescription
CommandThe path of the script or executable to run; supports .bat, .ps1, .cmd, .exe, .py and more. You can pick a file with the "Browse" button.
ArgumentsExtra arguments passed to the command; optional.
Administrator privilegesWhen checked, the task runs with the highest privileges, suitable for operations requiring UAC elevation.

Task Operations ​

After creating a task, you can perform the following operations:

OperationDescription
Run nowForce the task to run immediately, regardless of scheduling rules.
Enable/DisablePause or resume the task's automatic scheduling.
DeleteRemove the task from the Task Scheduler.

Scheduling Rules ​

Cron Expressions ​

Tasks use the standard 5-field Cron expression to define execution rules, in the following format:

minute hour day month weekday
FieldRangeDescription
minute0 - 59Which minute of every hour to run
hour0 - 23Which hour of every day to run
day1 - 31Which day of every month to run
month1 - 12Which month of every year to run
weekday0 - 7Both 0 and 7 mean Sunday

Each field supports the following syntax:

  • * — matches all values (e.g. * * * * * means run every minute)
  • */N — run every N units (e.g. */5 * * * * means run every 5 minutes)
  • A single number — matches a specific value (e.g. 0 9 * * 1 means run at 9:00 AM every Monday)

Note: Comma-separated lists (such as 1,15) and range expressions (such as 1-5) are not supported; see Notes below for more limitations.

Supported Combination Patterns ​

This software does not run a native cron daemon; instead, it translates Cron expressions into Windows Scheduled Task (schtasks.exe) trigger parameters. For accurate mapping, the parser hardcodes support for the following 7 combination patterns, covering most scheduled-task scenarios:

#PatternDescriptionUse case
1* * * * *Run every minuteMonitoring, real-time detection tasks
2*/N * * * *Run every N minutesPeriodic check tasks
3M * * * *Run at minute M of every hour (e.g. 3 * * * *)On-the-hour tasks
4M H * * *Run at H:M every day (e.g. 0 3 * * *)Daily maintenance, e.g. cleaning up logs in the early morning
5M H * * DOWRun at H:M on a specific weekday (e.g. 0 12 * * 1)Weekly routine tasks, e.g. backing up data every Monday
6M H D * *Run at H:M on a specific day of the monthMonthly tasks, e.g. generating a report on the 1st of every month
7M H D MON *Run at H:M on a specific month and day of the yearYearly tasks, e.g. running in a specified month

If an expression doesn't match any of the 7 patterns above, the system treats it as an Unsupported cron pattern and refuses to create the task.

Notes ​

Because it is implemented on top of Windows Scheduled Tasks, this software's Cron parser differs from standard Linux Cron in the following ways:

1. Lists (,) and ranges (-) are not supported ​

Standard Cron allows defining multiple discrete time points with commas (such as 1,15,30 * * * * for minutes 1, 15, and 30), or ranges with a hyphen (such as 1-5 * * * * for minutes 1 through 5).

Limitation of this software: each field can only contain a single number, an asterisk (*), or a step (*/N); commas and hyphens are not supported.

2. Free-form combinations are not supported ​

Standard Cron allows arbitrary combinations of fields (such as * 3 * * * meaning every minute of the 3 AM hour), but this software only supports the 7 fixed patterns listed above; expressions outside this set are rejected.

3. Time alignment differences for step patterns ​

In standard Cron, */5 * * * * aligns strictly to clock minutes 0, 5, 10, 15.... This software translates it to Windows' /SC MINUTE /MO 5 argument, and Windows calculates the interval from the moment the task is created or enabled.

For example, if you save and enable a task that runs every 5 minutes at 10:02, it will first run at 10:07, then 10:12, rather than aligning to 10:05 on the standard clock.