#scheduled #task #windows


planif is a builder pattern wrapper for the windows task scheduler API of windows-rs

8 releases (1 stable)

1.0.0 Nov 17, 2023
0.2.2 Jun 16, 2023
0.2.1 Oct 22, 2022
0.1.1 Aug 4, 2022
0.0.0-alpha Apr 20, 2022

#34 in Windows APIs

Download history 3/week @ 2023-08-06 6/week @ 2023-08-13 2/week @ 2023-08-20 9/week @ 2023-08-27 12/week @ 2023-09-03 14/week @ 2023-09-10 19/week @ 2023-09-17 17/week @ 2023-09-24 14/week @ 2023-10-01 4/week @ 2023-10-08 6/week @ 2023-10-15 14/week @ 2023-10-22 16/week @ 2023-10-29 10/week @ 2023-11-05 34/week @ 2023-11-12 18/week @ 2023-11-19

80 downloads per month

MIT license


planif is a builder pattern wrapper around the windows task scheduler API (windows-rs).


The planif crate provides an ergonomic builder over top of the Win32 Task Scheduler API.

The builder supports the following trigger types:

  • Boot
  • Daily
  • Event
  • Idle
  • Logon
  • MonthlyDOW
  • Monthly
  • Registration
  • Time
  • Weekly


Add this to your Cargo.toml file:

planif = "0.2"


use chrono::prelude::*;
use planif::enums::TaskCreationFlags;
use planif::schedule_builder::{Action, ScheduleBuilder};
use planif::schedule::TaskScheduler;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let ts = TaskScheduler::new()?;
    let com = ts.get_com();
    let sb = ScheduleBuilder::new(&com).unwrap();

        .description("Test Trigger")?
        .trigger("test_trigger", true)?
        .action(Action::new("test", "notepad.exe", "", ""))?
        .register("TaskName", TaskCreationFlags::CreateOrUpdate as i32)?;


For more examples, refer to the planif/examples folder. The folder contains code for creating each of the triggers.

Trigger settings

All settings are available for the tasks.

The documentation contains all relevant information from the Microsoft Task Scheduler documentation.

Running examples

After cloning the repository, examples can be run using either

cargo run --example <name> to run a specific example or, cargo run --examples to run all examples.


See the changelog file.

Upgrade Guide (0.* to 1.0)



The ComRuntime is now handled by the TaskScheduler and should be created using:

    let ts = TaskScheduler::new()?;
    let com = ts.get_com();
    let sb = ScheduleBuilder::new(&com).unwrap();
    // ... snip


ScheduleBuilder's no longer need to be manually uninitialized. In pre-1.0, ScheduleBuilding::uninitalize() would call CoUninitialize which would effectively close the COM. This could be problamatic if you had multiple builders or schedules built since having n+1 COMs would simply reuse the initial COM.

The changes brought in 1.0 will now keep an Rc<Com> privately stored in the TaskScheduler. Now when all the references are dropped, the COM uninitialization will be handled "automagically".


~2.5M SLoC