Skip to content

Task Scheduler ​

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

Example use cases:

  • Regularly back up WSL distributions
  • Execute custom scripts or commands

All tasks are organized under \WSLDashboard\UserTasks\ in Windows Task Scheduler for centralized management. You can view real-time task status (Ready / Running / Disabled) in the interface.

Community Scripts ​

You can download example scripts (backup distributions) from the community repository to get started quickly:

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

This is a community-driven code repository. Pull Requests are welcome to contribute scripts or share best practices.

Run Command ​

Command Configuration ​

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

SettingDescription
CommandPath to the script or executable. Supports .bat, .ps1, .cmd, .exe, .py formats. Use the "Browse" button to select a file.
ArgumentsAdditional arguments to pass to the command, optional.
Run with admin privilegesWhen enabled, 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:

ActionDescription
Run nowForce the task to execute immediately, regardless of schedule.
Enable/DisablePause or resume the task's automatic schedule.
DeleteRemove the task from the Task Scheduler.

Schedule Rules ​

Cron Expression ​

Task scheduling uses the standard 5-field Cron expression to define execution rules, formatted as follows:

minute hour day month weekday
FieldRangeDescription
minute0 - 59The minute of the hour to execute
hour0 - 23The hour of the day to execute
day1 - 31The day of the month to execute
month1 - 12The month of the year to execute
weekday0 - 7Day of the week (0 and 7 both represent Sunday)

Each field supports the following syntax:

  • * — Matches all values (e.g., * * * * * means every minute)
  • */N — Every N units (e.g., */5 * * * * means every 5 minutes)
  • Single number — Matches a specific value (e.g., 0 9 * * 1 means every Monday at 9:00 AM)

Note: Comma-separated values (e.g., 1,15) and range expressions (e.g., 1-5) are not supported. For more limitations, see Important Notes below.

Supported Combination Patterns ​

This software does not run a native Cron daemon. Instead, it translates Cron expressions into Windows Task Scheduler (schtasks.exe) trigger parameters. To ensure accurate mapping, the parser only supports the following 7 combination patterns, covering most scheduled task scenarios:

#PatternDescriptionUse Case
1* * * * *Execute every minuteMonitoring, real-time detection tasks
2*/N * * * *Execute every N minutesPeriodic check tasks
3M * * * *Execute at minute M of every hour (e.g., 3 * * * *)Hourly tasks
4M H * * *Execute at H:M every day (e.g., 0 3 * * *)Daily maintenance, e.g., cleaning logs at midnight
5M H * * DOWExecute at H:M on a specific day of the week (e.g., 0 12 * * 1)Weekly routine tasks, e.g., backing up data every Monday
6M H D * *Execute at H:M on a specific day of the monthMonthly tasks, e.g., generating reports on the 1st
7M H D MON *Execute at H:M on a specific month and dayAnnual tasks, e.g., executing in a specific month

If the expression does not match any of the above 7 patterns, the system will reject it as Unsupported cron pattern.

Important Notes ​

Since the implementation is based on Windows Task Scheduler, the Cron parser in this software differs from standard Linux Cron in the following ways:

1. Lists (,) and Ranges (-) Not Supported ​

Standard Cron allows defining multiple discrete time points with commas (e.g., 1,15,30 * * * * means at minutes 1, 15, and 30), or ranges with hyphens (e.g., 1-5 * * * * means minutes 1 through 5).

This software's limitation: Each field can only contain a single number, asterisk (*), or step value (*/N). Commas and hyphens are not supported.

2. Free-form Combinations Not Supported ​

Standard Cron allows arbitrary combinations of fields (e.g., * 3 * * * means every minute during the 3:00 hour). However, this software only supports the 7 fixed patterns listed above. Expressions outside this range will be rejected.

3. Time Alignment Difference in Step Patterns ​

In standard Cron, */5 * * * * strictly aligns to clock minutes 0, 5, 10, 15.... This software translates it to Windows' /SC MINUTE /MO 5 parameter. 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 execute at 10:07, then 10:12, rather than aligning to the standard clock's 10:05.