Quartz.NET

Open-source job scheduling system for .NET

Get Started

Runtime Environments

Can run embedded within an application or even instantiated as a cluster of stand-alone programs (with load-balance and fail-over capabilities)

Job Scheduling

Jobs are scheduled to run when a given trigger occurs, triggers support wide variety of scheduling options

Job Execution

Jobs can be any .NET class that implements the simple IJob interface, leaving infinite possibilities for the work jobs can perform

Job Persistence

Job stores can be implemented to provide various mechanisms for the storage of jobs, in-memory and multiple relational databases come supported out of the box

Built-in support for load balancing your work and graceful fail-over

Listeners & Plug-Ins

Applications can catch scheduling events to monitor or control job/trigger behavior by implementing one or more listener interfaces.

Quartz.NET is a full-featured, open source job scheduling system that can be used from smallest apps to large scale enterprise systems.

# Latest News

TaskScheduler 2.10.1

  • Package Manager
  • PackageReference
  • Script & Interactive
  • Dependencies

The original and most popular .NET wrapper for the Windows Task Scheduler . It provides functionally complete classes that cover all development aspects related to system tasks.

More information can be found on the project page on GitHub .

Below are links to sites that provide in-depth examples, documentation and discussions. Please go here first with your questions as the community has been active for over a decade.

  • Wiki - Sample code, library how-to, troubleshooting, etc.
  • API documentation - Class/method/property documentation and examples
  • Full Issues Log - Use the search box to see if your question may already be answered.
  • Discussion Forum - Users helping users, enhancement requests, Q&A (retired Google forum here )
  • Troubleshooting Tool - Tool to help identify and fix configuration and connectivity issues. (ClickOnce installer here )

Key Features

Microsoft introduced version 2.0 (internally version 1.2) with a completely new object model with Windows Vista. The managed assembly closely resembles the new object model but allows the 1.0 (internally version 1.1) COM objects to be manipulated. It will automatically choose the most recent version of the library found on the host system (up through 1.4). Core features include:

  • Separate, functionally identical, libraries for .NET 2.0, 3.5, 4.0, 4.52, 5.0, 6.0, .NET Standard 2.0, .NET Core 2.0, 2.1, 3.0, 3.1.
  • Unlike the base COM libraries, this wrapper accommodates creating and viewing tasks up and down stream.
  • Supports all V2 native properties, even under V1 tasks.
  • Maintain EmailAction and ShowMessageAction using PowerShell scripts for systems after Win8 where these actions have been deprecated.
  • Supports all action types (not just ExecAction) on V1 systems (XP/WS2003) and earlier (if PowerShell is installed).
  • Supports multiple actions on V1 systems (XP/WS2003). Native library only supports a single action.
  • Supports serialization to XML for both 1.0 and 2.0 tasks (base library only supports 2.0)
  • Supports task validation for targeted version.
  • Supports secure task reading and maintenance.
  • Fluent methods for task creation.
  • Cron syntax for trigger creation.

The currently supported localizations include: English, Spanish, Italian, French, Chinese (Simplified), German, Polish and Russian.

You can perform several actions in a single line of code:

For many more options, use the library classes to build a complex task. Below is a brief example of how to use the library from C#.

For extended examples on how to the use the library, look at the Examples Page .

.NETCoreApp 2.0

  • Microsoft.Win32.Registry (>= 5.0.0)
  • System.Diagnostics.EventLog (>= 5.0.0)
  • System.Security.AccessControl (>= 5.0.0)

.NETCoreApp 2.1

.netcoreapp 3.0, .netcoreapp 3.1, .netframework 2.0.

  • No dependencies.

.NETFramework 3.5

.netframework 4.0, .netframework 4.5.2, .netstandard 2.0.

  • System.Reflection (>= 4.3.0)
  • System.Runtime.Serialization.Formatters (>= 4.3.0)
  • System.Security.Permissions (>= 5.0.0)
  • System.Security.Principal.Windows (>= 5.0.0)
  • System.Xml.XmlSerializer (>= 4.3.0)

net5.0-windows7.0

Net6.0-windows7.0, nuget packages (16).

Showing the top 5 NuGet packages that depend on TaskScheduler:

GitHub repositories (62)

Showing the top 5 popular GitHub repositories that depend on TaskScheduler:

Scott Hanselman

Exploring the .net core library coravel for task scheduling, caching, mailing and more.

Coravel claims it is a "Near-zero config .NET Core library that makes Task Scheduling, Caching, Queuing, Mailing, Event Broadcasting (and more) a breeze!" A lovely claim, that is, in fact, true! It's open source and on Github at https://github.com/jamesmh/coravel so give Coravel a star !

Coravel is available on NuGet as a package - as are all things  - or you can also install it's helper CLI with a simple dotnet tool install --global coravel-cli . After this, using coravel easy, early, and often is as simple as:

A nice teach that makes it easy, the coravel CLI adds the package reference, restores your project, and reminds you to set it up in ConfigureServices() in Startup.cs. A nice example of a thoughtful library that is trying to make onboarding simpler.

The Coravel CLI is also a nice scaffolder to get you started with item templates:

But what is it?

Coravel

When you start thinking about layering and responsibilities of real production software, you'll note that there are arguably some gaps in the BCL (Base Class Libraries) that .NET makes available, particularly as you move up into the Application Development space.

Scheduled jobs and tasks, simple emailing with Razor Templates, a lightweight event dispatcher, easily queueable background tasks are just some of the higher level primitives you'll find yourself wanting when creating business apps. Coravel collects those buildable elements and allows you to string them together very quickly.

For example, I'll create an "Invocable." Basically just a method that is more 'job-like.' It has business scope and I need to have it invoked later by some schedule or process within my app.

Here I'll register one in my Startup.cs.

So I need to send a nightly report. That's an invocable thing, and it's also an IMailer because it mails things. Note the injected IMailer in the constructor. All very natural in ASP.NET Core, using Dependency Injection.

Then I can have this mailed every evening with the Coravel Scheduler:

But when, right? Easy:

What if you have a task that needs to happen, but maybe it's either long-running or happening often. You don't want two tasks going at the same time, so PreventOverlapping! Clever.

And that's just the scheduler. That mail you have to send? You can use Razor Pages to create reach HTML emails! That makes New User Sign Up, or Completed Order very easy to create. All self-contained in your app. I dig it.

Finally note that there's Pro paid version of Coravel that gives you a very professional UI for Jobs and Invocables, and allows you to visually configure your back-end job schedules. A nice way to support open source - especially when you start using it and really depending on it - is to explore very reasonable Pro licenses like those that Pro Coravel has. Impressive stuff, truly.

*I have no relationship with Coravel the project or the Pro licenses, I'm just a fan.

Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

net task scheduler library

Search code, repositories, users, issues, pull requests...

Provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

Provides a .NET wrapper for the Windows Task Scheduler. It aggregates the multiple versions, provides an editor and allows for localization.

dahall/TaskScheduler

Folders and files, repository files navigation, task scheduler managed wrapper.

Version

The original .NET wrapper for the Windows Task Scheduler that aggregates the multiple versions and provides localized controls for editing.

Quick Links

  • Wiki - Sample code, library how-to, troubleshooting, etc.
  • API documentation - Class/method/property documentation and examples
  • Full Issues Log - Use the search box to see if your question may already be answered.
  • Discussion Forum - Users helping users, enhancement requests, Q&A (retired Google forum here )
  • ITaskHandler Template and Sample Project - Use this to create your own COM based assembly for in-process actions.
  • Troubleshooting Tool - Tool to help identify and fix configuration and connectivity issues. (ClickOnce installer here )

Installation

This project's assemblies are available via NuGet or manually from the .zip files in the Releases section.

You can also find prerelease NuGet pacakges on the project's AppVeyor NuGet feed .

Once referenced by your project, all classes can be found in the Microsoft.Win32.TaskScheduler namespace.

Project Components

Main library.

Microsoft introduced version 2.0 (internally version 1.2) with a completely new object model with Windows Vista. The managed assembly closely resembles the new object model, but allows the 1.0 (internally version 1.1) COM objects to be manipulated. It will automatically choose the most recent version of the library found on the host system (up through 1.4). Core features include:

  • Separate, functionally identical, libraries for .NET 2.0, 3.5, 4.0, 4.52, 5.0, 6.0, .NET Standard 2.0, .NET Core 2.0, 2.1, 3.0, 3.1.
  • Unlike the base COM libraries, this wrapper helps to create and view tasks up and down stream.
  • Written in C#, but works with any .NET language including scripting languages (e.g. PowerShell).
  • Supports all V2 native properties, even under V1 systems.
  • Maintain EmailAction and ShowMessageAction using PowerShell scripts for systems after Win8 where these actions have been deprecated.
  • Supports all action types (not just ExecAction) on V1 systems (XP/WS2003) and earlier (if PowerShell is installed).
  • Supports multiple actions on V1 systems (XP/WS2003). Native library only supports a single action.
  • Supports serialization to XML for both 1.0 and 2.0 tasks (base library only supports 2.0)
  • Supports task validation for targeted version.
  • Supports secure task reading and maintenance.
  • Fluent methods for task creation.
  • Cron syntax for trigger creation.
  • Supports reading "custom" triggers under Win8 and later.
  • Numerous work-arounds and checks to compensate for base library shortcomings.

The currently supported localizations include: English, Spanish, Italian, French, Chinese (Simplified), German, Polish and Russian. Others localizations can be added upon request, especially if you're willing to help with translations.

The project is based on work the originator started in January 2002 with the 1.0 library that is currently hosted on CodeProject .

A second library includes localized and localizable GUI editors and a wizard for tasks which mimic the ones in Vista and later and adds optional pages for new properties. Following is the list of available UI controls:

  • Task editor dialog and tabbed control which mimics system editor (TaskEditDialog)
  • Task editor dialog using newer UI scheme (TaskOptionsEditor)
  • Task creation wizard which mimics system Basic editor
  • Action editor dialog
  • Trigger editor dialog
  • Event viewer dialog
  • Task / task folder selection dialog
  • Task history viewer
  • Task run-times viewer
  • Task service connection dialog
  • Simplified classes for pulling events from the system event log.
  • A DropDownCheckList control that is very useful for selecting flag type enumerations.
  • A FullDateTimePicker control which allows both date and time selection in a single control.
  • A CredentialsDialog class for prompting for a password which wraps the Windows API.

Sample Code

There is a help file included with the download that provides an overview of the various classes. There are numerous examples under the "Documentation" tab.

You can perform a number of actions in a single line of code:

For many more options, use the library classes to build a complex task. Below is a brief example of how to use the library from C#.

For extended examples on how to the use the library, look in the source code area or look at the Examples Page . The library closely follows the Task Scheduler 2.0 Scripting classes. Microsoft has some examples on Microsoft Docs around it that may further help you understand how to use this library.

This project appreciatively uses:

Sandcastle Help File Builder

Code of conduct

Releases 36, used by 1.9k.

@bajins

Contributors 6

@dahall

  • Visual Basic .NET 0.1%

net task scheduler library

  • Latest Articles
  • Top Articles
  • Posting/Update Guidelines
  • Article Help Forum

net task scheduler library

  • View Unanswered Questions
  • View All Questions
  • View C# questions
  • View C++ questions
  • View Javascript questions
  • View PHP questions
  • View Python questions
  • CodeProject.AI Server
  • All Message Boards...
  • Running a Business
  • Sales / Marketing
  • Collaboration / Beta Testing
  • Work Issues
  • Design and Architecture
  • Artificial Intelligence
  • Internet of Things
  • ATL / WTL / STL
  • Managed C++/CLI
  • Objective-C and Swift
  • System Admin
  • Hosting and Servers
  • Linux Programming
  • .NET (Core and Framework)
  • Visual Basic
  • Web Development
  • Site Bugs / Suggestions
  • Spam and Abuse Watch
  • Competitions
  • The Insider Newsletter
  • The Daily Build Newsletter
  • Newsletter archive
  • CodeProject Stuff
  • Most Valuable Professionals
  • The Lounge  
  • The CodeProject Blog
  • Where I Am: Member Photos
  • The Insider News
  • The Weird & The Wonderful
  • What is 'CodeProject'?
  • General FAQ
  • Ask a Question
  • Bugs and Suggestions

net task scheduler library

Task Scheduler Library for .NET

net task scheduler library

  • Download demo project and source - 28.2 KB
  • Download compiled library and help - 87.4 KB

Important Notice!!!

This library has been significantly changed and updated to include all the functionality available in the Task Scheduler 2.0 library available on Vista/Server 2008 and later. The new library is available as a community project on GitHub and is available via NuGet . This new library automatically supports all current Windows platforms and uses the most current library. It compensates for missing features from both libraries where possible. The model is simpler and more modular. I won't be continuing any work on the code posted here in CodeProject as it does not conform to the constructs of the updated library.

The basics of building .NET Interop wrappers around COM libraries that are documented here are what I used for the new project. If you’re trying to understand how to do that, look here.

Introduction

The Task Scheduler is a component delivered with Internet Explorer since version 4.0, and is made up of a set of COM objects. The user can interact with tasks through the "Scheduled Tasks" entry in the Control Panel. The Task Scheduler objects provide an excellent means of scheduling events for your programs. I have never really liked the "pseudo object-oriented" approach taken by Microsoft in their design of COM objects. I have wrapped the Task Scheduler COM objects into a series of .NET classes. These classes expose the entire library and make it conform to more of a ".NET" style of class design.

In this article, I will present the library and the things I learned along the way about using .NET development and COM Interop services. This article has the following sections:

Library Documentation

Example code.

One of the things I wanted to do was provide a single library that would give full access to the Task Scheduler. This meant that I could not use the Visual Studio .NET model of importing COM objects which creates a new .dll file for each imported class. To accomplish this, I had to use some .NET Framework SDK tools to create the .cs file that would provide access to the COM objects via COM Interop services. Since Microsoft decided to not provide a type library for the Task Scheduler, I created one with the MIDL tool from the Platform SDK and the mstask.idl file provided by Microsoft. Once I had the library, I was able to use the TLBIMP tool from the .NET Framework SDK to create an assembly. I then used the Object Browser along with the original .idl file to effectively cut and paste the class, method, and property definitions to my own .cs file. During this part of my adventure, I discovered two important things. First, the order of methods in the interop classes must match the order in the .idl file, and if an interface derives from another interface, you have to provide the base interface's methods in the interop (there is no derivation allowed). Second, the TLBIMP tool does some special things that aren't initially apparent in the area of attributes.

  • All structures must have the [StructLayout(LayoutKind.Sequential)] attribute defined.
  • All unions must have the [StructLayout(LayoutKind.Explicit)] attribute defined, and each block of the union must have the [FieldOffset(0)] attribute defined.
  • All parameters that convert from a wide string to System.String must have the [MarshalAs(UnmanagedType.LPWStr)] attribute defined.
  • All parameters that pass a COM interface must have the [MarshalAs(UnmanagedType.Interface] attribute defined.
  • All parameters that pass a .idl defined structure must have the [MarshalAs(UnmanagedType.Struct)] attribute defined.
  • Dealing with pointers to variable length parameters is a black art.
  • If the .idl file says a parameter is [in] , the parameter is [In] in C#.
  • If the .idl file says a parameter is [out] , the parameter is [Out] in C#.
  • If the .idl file says a parameter is [in, out] , mark the parameter as ref and specify if it is really [In] and/or [Out] .
  • If the .idl file says a parameter is an [out] pointer to a value, you do not need to make it a pointer in C#.
  • If the .idl file says a parameter is a pointer to a pointer (**) and it is not an interface, you have to make it a System.IntPtr and deal with converting it in the code.
  • When getting an interface pointer where the .idl file has it as [out] ISomeInterface** pSomeInt , you will use [Out, MarshalAs(UnmanagedType.Interface)] out ISomeInterface SomeInt .
  • If a method returns an HRESULT as an out or retval parameter, it must have the [MarshalAs(UnmanagedType.Error] attribute and be passed as a System.Int32 .

There are two bits of coding that were nontrivial. The first was the Hidden property on the Task class. Warning, this was a hack. I realized that the tasks are actually just files in a special directory. Once they are created, you have to use the IPersist interface to save them. This interface lets you find out the path of the file. Using this information, I experimented and found that setting the hidden attribute on the file does hide the task from the UI but does not seem to have an effect on the COM object finding it. I did have to clear that attribute before saving it though.

The second challenge was demystifying the black art of variable length arrays. This was done in the Task.Tag property. I decided to use serialization to get and put information into the tag. This provides a way to encode and decode objects into a byte stream. To put the object into the array, I first make sure it is serializable. I then serialize it into a MemoryStream and pass the stream's buffer into the COM object.

To get the object out of the array, I had to use the Marshal.Copy function to convert the IntPtr to a byte array. I then converted the byte array into a BinaryFormatter object so that I could convert the data back into an object instance. The code below shows the process.

Included with the library is an HTML help file describing all of the objects defined. The following graphic provides a broad overview of the classes.

Image 1

The Scheduler class represents the machine specific instance of the system task scheduler. It has very little use other than providing access to the list of tasks through its Tasks property. The Tasks property exposes a TaskList instance that provides an indexer which allows access to individual tasks by name. The TaskList class also has methods that allow for the creation and deletion of tasks by name. Since TaskList implements the IEnumerable interface, you can also enumerate all tasks using the foreach construct.

A task is represented by a Task instance. The Task class exposes all of the properties of a task which allow you to define what will run when the task is triggered. The only property that must be set for proper execution is ApplicationName , which specifies the full path of the executable which will be run when triggered. The Task class also provides some properties that give information about the execution of the task and some methods that allow for the running and termination of a task.

Each task has a list of triggers that determine when the task will be run. These are accessed through the Triggers property which exposes a TriggerList instance. TriggerList provides an indexer which allows access to individual triggers by their position in the list. The TriggerList class also has methods that allow for the addition and removal of triggers. TriggerList implements the IList interface so you can also enumerate all tasks using the foreach construct.

The Trigger class is an abstract class that forms the foundation of the different types of triggers that can be specified for a task. There are eight different specializations that provide different ways to specify the time a task will run. See the help file for details about each of the trigger classes.

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Comments and Discussions

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

net task scheduler library

  • Network Programming
  • Windows Programming
  • Visual Studio
  • Visual Basic

Logo

Understanding the .NET Task Parallel Library TaskScheduler

CodeGuru Staff

The most talented orchestra will sound uninspired without an equally talented conductor. Similar conclusions can be drawn to a Parallel Programming workload conductor. The .NET Task Parallel Library (TPL) Parallel programming conductor is the TaskScheduler . TaskScheduler is arguably one of the more enigmatic TPL classes. It’s hardly noticeable; yet it’s critical to a smoothly executing Parallel workload.

Compounding its mystery is the appearance of multiple TPL TaskSchedulers; the Default and specialized TaskSchedulers that, for example, execute Tasks on the Windows Presentation Foundation (WPF) user interface threads. The best way to understand TaskScheduler is to implement a custom TaskScheduler, run a parallel workload on the custom TaskScheduler, and observe what happens. That’s exactly what this article will do, beginning with an overview of the sample workload.

A demonstration Parallel workload appears below.

The code executes 4 Tasks on TPL. A complete introduction to Tasks is beyond the scope of this article, but Understanding Tasks in .NET Framework 4.0 Task Parallel Library is a good introduction.

Tasks simulate a workload executing Thread.Sleeps inside Llamda expressions. The running code produces output resembling what you see below.

Part of the output indicates the Thread Id of the code executing the Write statement. Thread Id 9 is the application’s main Thread. Thread 10 is a Thread created by the SimpleScheduler TaskScheduler class. Later in the article I’ll explain where this Thread is created.

As stated earlier the article will walk through a custom TaskScheduler. SimpleScheduler is a custom TaskScheduler implementation.

SimpleScheduler Architecture

TaskScheduler is an Abstract class. So, building a custom Scheduler requires some Overrides. A list of Overridable functions appears below.

As you may have noticed all the overrides are protected. Like other .NET components TPL is as much a Runtime environment as it is a collection of classes. When a Task invokes Start, the Runtime funnels the Task to the QueueTask and the TryExecuteInLine methods on the selected TaskScheduler.

Overriding MaximumConcurrencyLevel and TryDequeue are optional. Every class must Override QueueTask, TryExecuteInLine, and GetScheduledTasks.

Overriding GetScheduledTasks is required for debugger support.

For later reference, the full source code for SimpleScheduler appears below.

QueueTask is the heart of the SimpleScheduler.

The QueueTask implementation appears below.

As stated earlier, the TPL runtime funnels Tasks to the QueueTask method. QueueTask does two things. First it adds the incoming Task to a BlockingCollection. A complete introduction to BlockingCollection is beyond the scope of this article, but Introducing the .NET Framework 4.0 Task Parallel Library BlockingCollection is a helpful introduction.

After adding to the BlockingCollection; QueueTask starts a Thread that removes Tasks from the BlockingCollection and executes the Task.

Executing a Task

The Main method runs inside of an executing Thread. As you may recall in the output displayed earlier in the article; this is Thread Id #10. Code for the Main method appears below.

GetConsumingEnumerable returns a Task each time a Task is added to the underlying BlockingCollection. The Foreach loop breaks when CompleteAdding is invoked on the BlockingCollection. In the sample; CompleteAdding is invoked inside the Dispose method. Failing to break out of the loop will keep the Thread alive and waiting for more Tasks.

After the Task executes; the underlying Task populates its Result value. Had there been Wait statements or Continuations these statements would have executed just like any other code attached to the Task.

Recommendations

Aside from the samples, there is not a lot of guidance for building TaskSchedulers. Much of what is written here comes from tinkering with the samples. In fact much of the Microsoft documentation recommends using the default TaskScheduler unless a developer has some really unique scenarios.

TaskSchedulers are an important component of .NET Framework Task Parallel Library. However TaskSchedulers are classes few developers will ever need to implement. A simple understanding of the TaskScheduler role is adequate for leveraging TPL.

Task Schedulers

Task Schedulers and Synchronization Context

CodeGuru Staff

More by Author

Best video game development tools, video game careers overview, the top task management software for developers, best online courses for .net developers, news & trends, c# versus c, different types of jit compilers in .net, get the free newsletter.

Subscribe to Developer Insider for top news, trends & analysis

Middleware in ASP.NET Core

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Advertisers

Advertise with TechnologyAdvice on CodeGuru and our other developer-focused platforms.

  • Privacy Policy
  • California – Do Not Sell My Information

Property of TechnologyAdvice. © 2023 TechnologyAdvice. All Rights Reserved Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.

How to use Task Scheduler on Windows to create automated tasks

Running automated tasks using Task Scheduler on Windows is easy, as we cover in this simple guide.

A laptop running Windows 11, representing an article about how to use task scheduler on windows

Once you know how to create an automated task using Task Scheduler on Windows, you'll never look back.

If you're running Windows 11 or are still on Windows 10 (or even earlier) you may not have been aware about a handy tool that's been hiding in plain sight the whole time. 

Windows Task Scheduler lets you open an app or run a script under predefined circumstances. For example, you may want Netflix to fire up at lunchtime so you know it's time to take a break with one of the best Netflix shows .

Whatever the reason, here's how to create an automated task using Windows Task Scheduler.

Note : The screenshots in this guide are from Windows 11, but the steps are the same for Windows 10.

In addition to our helpful tutorials, we also have a range of expertly crafted buying guides to help you make the right purchase. If you're in the market for some new tech, make sure you check out our guides to the best Windows laptops , best computers and best tablets first.

How to create an automated task using Task Scheduler on Windows

1. Open the Start menu and type " task scheduler ". Click on the Task Scheduler app icon when it appears.

2. Since every automated task in Windows is listed in the Task Scheduler, such as your PC automatically checking for app updates, it's a good idea to create a separate folder for personal tasks. To do this, click Task Scheduler Library on the left, then right-click on it before clicking New Folder . 

3. Enter a name for your task folder , then click OK when you're done.

4. Click the arrow next to Task Scheduler Library to expand the list, and you'll see your personal folder listed on the end. Click your personal folder then right-click it and click Create Basic Task .

5. You should now be in the Create Basic Task Wizard . To start, give your task a name in the first field. In the next field, add a description of the task if you wish, though this is optional. Click Next when you're done.

6. You now need to select what will trigger your task by choosing one of the options on this screen. Once selected, click next .

7. Now it's time to choose the desired action that will be performed upon the trigger. To get Windows to launch a program/app, select Start a program and click Next . You can also use this action to launch scripts, if you're familiar with how to use them.

Note : There are also options to send an email or display an on-screen message but these are deprecated, meaning they're no longer supported and may not work. As such, it's recommended to skip these.

8. On the next page, click Browse and locate the app or script you want to open , then double-click it . Once the app or script's path is shown in the Program/script field, click Next to continue.

9. Finally, click Finish to complete the process. 

10 . You should now also see the task appear in the personal folder you created earlier. Right-click the task's name and click either Properties or Delete to edit or delete the task, respectively.

And, that's all there is to it. Now you know how to create an automated task using Windows Task Scheduler, you might also find our guides on how to password protect folders on Windows , how to type emoji on Windows , how to open HEIC files on Windows , how to upgrade to Windows 11 from Windows 10 , how to fix a second monitor not detected on Windows , or how to set separate wallpapers on dual monitors in Windows 11 useful. If you're keen to maximise your professional productivity check out 11 Google Drive tips to save you time .

Get the BEST of Tom’s Guide daily right in your inbox: Sign up now!

Upgrade your life with the Tom’s Guide newsletter. Subscribe now for a daily dose of the biggest tech news, lifestyle hacks and hottest deals. Elevate your everyday with our curated analysis and be the first to know about cutting-edge gadgets.

Dale Fox

Dale Fox is a freelance journalist based in the UK. He's been a tech nerd ever since childhood, when he used the money from his first job as a paperboy to buy a subscription to GamesMaster magazine. Dale was previously a presenter and editor in China, where he also worked as a copywriter for OnePlus at its Shenzhen HQ.  

HP Smart Tank 7602 review

Acer Nitro V 15 review: Middling hardware ruined by overbearing software

How to watch The Good Doctor season 7 online: live stream the final season of the hit medical drama from anywhere

Most Popular

By Sam Hopes February 17, 2024

By Rachael Penn February 17, 2024

By Peter Wolinski February 17, 2024

By Peter Wolinski February 16, 2024

By Camilla Sharman February 16, 2024

By Rachael Penn February 15, 2024

By Grace Dean February 15, 2024

By Peter Wolinski February 14, 2024

By Grace Dean February 14, 2024

By Peter Wolinski February 13, 2024

By Madeleine Streets February 13, 2024

  • 2 I just reviewed the Hisense U7K Mini-LED TV — and it’s amazing for under $800
  • 3 Last chance! The 11 best Presidents' Day deals you can still shop
  • 4 Acer Nitro V 15 review: Middling hardware ruined by overbearing software
  • 5 Apple’s iOS 17.4 update features new insight into your iPhone's battery life

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Task Parallel Library (TPL)

  • 13 contributors

The Task Parallel Library (TPL) is a set of public types and APIs in the System.Threading and System.Threading.Tasks namespaces. The purpose of the TPL is to make developers more productive by simplifying the process of adding parallelism and concurrency to applications. The TPL dynamically scales the degree of concurrency to use all the available processors most efficiently. In addition, the TPL handles the partitioning of the work, the scheduling of threads on the ThreadPool , cancellation support, state management, and other low-level details. By using TPL, you can maximize the performance of your code while focusing on the work that your program is designed to accomplish.

In .NET Framework 4, the TPL is the preferred way to write multithreaded and parallel code. However, not all code is suitable for parallelization. For example, if a loop performs only a small amount of work on each iteration, or it doesn't run for many iterations, then the overhead of parallelization can cause the code to run more slowly. Furthermore, parallelization, like any multithreaded code, adds complexity to your program execution. Although the TPL simplifies multithreaded scenarios, we recommend that you have a basic understanding of threading concepts, for example, locks, deadlocks, and race conditions, so that you can use the TPL effectively.

Related articles

  • Samples for Parallel Programming with the .NET Core & .NET Standard

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback .

Submit and view feedback for

Additional resources

IMAGES

  1. Task scheduler library windows 10

    net task scheduler library

  2. How To Fix Task Scheduler In Windows 10 In Just A Few Simple Steps

    net task scheduler library

  3. Task scheduler library windows 10

    net task scheduler library

  4. How to create an automated task using Task Scheduler on Windows 10

    net task scheduler library

  5. How To Reboot Your Computer Using Task Scheduler On Windows 10

    net task scheduler library

  6. task-scheduler-library-0093

    net task scheduler library

VIDEO

  1. Media Manager Demo

  2. #76 Task Scheduler

  3. Kernels! WhoFi Meeting Room Scheduler

  4. Quartz Scheduler Sharding with Spring Boot

  5. On .NET Live

  6. Online Task Management System php asp.net

COMMENTS

  1. TaskScheduler Class (System.Threading.Tasks)

    Definition Namespace: System. Threading. Tasks Assembly: System.Runtime.dll Represents an object that handles the low-level work of queuing tasks onto threads. C# public abstract class TaskScheduler Inheritance Object TaskScheduler Examples The following example creates a custom task scheduler that limits the number of threads used by the app.

  2. System.Threading.Tasks.TaskScheduler class

    The default scheduler for the Task Parallel Library and PLINQ uses the .NET thread pool, which is represented by the ThreadPool class, to queue and execute work.

  3. Home

    Quartz.NET. Open-source job scheduling system for .NET. Get Started . ... Jobs are scheduled to run when a given trigger occurs, triggers support wide variety of scheduling options. Job Execution. Jobs can be any .NET class that implements the simple IJob interface, leaving infinite possibilities for the work jobs can perform.

  4. NuGet Gallery

    The original and most popular .NET wrapper for the Windows Task Scheduler. It provides functionally complete classes that cover all development aspects related to system tasks. More information can be found on the project page on GitHub. Support Below are links to sites that provide in-depth examples, documentation and discussions.

  5. Exploring the .NET Core library Coravel for Task Scheduling, Caching

    scheduler.Schedule<SendNightlyReportsEmailJob>().DailyAt(1, 30).Zoned(TimeZoneInfo.Local); What if you have a task that needs to happen, but maybe it's either long-running or happening often. You don't want two tasks going at the same time, so PreventOverlapping! Clever. scheduler.Schedule<DoAThingOften>().EveryMinute()

  6. Task-based asynchronous programming

    The Task Parallel Library (TPL) is based on the concept of a task, which represents an asynchronous operation. In some ways, a task resembles a thread or ThreadPool work item but at a higher level of abstraction. The term task parallelism refers to one or more independent tasks running concurrently. Tasks provide two primary benefits:

  7. Recommend a C# Task Scheduling Library

    1 Check out the natively available Azure Scheduler, introduced in 2014 - azure.microsoft.com/en-us/services/scheduler - mvark Jun 22, 2014 at 14:21 Add a comment 6 Answers Sorted by: 65 http://quartznet.sourceforge.net/ "Quartz.NET is a port of very propular (sic!) open source Java job scheduling framework, Quartz."

  8. dahall/TaskScheduler

    The original .NET wrapper for the Windows Task Scheduler that aggregates the multiple versions and provides localized controls for editing. Quick Links Wiki - Sample code, library how-to, troubleshooting, etc. API documentation - Class/method/property documentation and examples

  9. A New Task Scheduler Class Library for .NET

    Task Scheduler is the Windows service that schedules and automatically starts programs. Windows Explorer presents a user interface to the service when you browse the %WINDIR%\TASKS folder, typically from the shortcut in the control panel. From the command line, the schtasks command and the old at command do the same.

  10. Task Scheduler Library for .NET

    Windows .NET Task Scheduler Library for .NET David Hall Rate me: 4.84/5 (38 votes) 9 Jul 2009 CPOL 7 min read 516.3K 9.8K 194 124 A library for .NET that encapsulates the Task Scheduler COM object. Download demo project and source - 28.2 KB Download compiled library and help - 87.4 KB Important Notice!!!

  11. TaskScheduler.GetScheduledTasks Method (System.Threading.Tasks)

    Remarks. A class derived from TaskScheduler implements this method in order to support integration with debuggers. This method will only be invoked by the .NET Framework when the debugger requests access to the data. The enumerable returned will be traversed by debugging utilities to access the tasks currently queued to this scheduler, enabling the debugger to provide a representation of this ...

  12. TaskScheduler.QueueTask(Task) Method (System.Threading.Tasks)

    Definition Namespace: System. Threading. Tasks Assembly: System.Runtime.dll Queues a Task to the scheduler. C# protected internal abstract void QueueTask (System.Threading.Tasks.Task task); Parameters task Task The Task to be queued. Exceptions ArgumentNullException The task argument is null. Remarks

  13. Hangfire

    An easy way to perform background processing in .NET and .NET Core applications. No Windows Service or separate process required. Backed by persistent storage. Open and free for commercial use. Fire-and-Forget Jobs Fire-and-forget jobs are executed only once and almost immediately after creation.

  14. Understanding the .NET Task Parallel Library TaskScheduler

    Library (TPL) Parallel programming conductor is the TaskScheduler. TaskScheduler is arguably one of the more enigmatic TPL classes. It's hardly noticeable; yet it's critical to a smoothly executing Parallel workload. Compounding its mystery is the appearance of multiple TPL

  15. How to use Task Scheduler on Windows

    1. Open the Start menu and type " task scheduler ". Click on the Task Scheduler app icon when it appears. (Image credit: Future) 2. Since every automated task in Windows is listed in the...

  16. Accessing Windows Scheduled Task using C#

    4 Answers Sorted by: 5 Instead of using code, you can do it using 'SCHTASKS' command, run it using System.Diagnostic.Process.Start method with the parameters required. It's easy and not much effort required. Share Improve this answer Follow answered Jun 1, 2010 at 12:32 Durgesh Gupta 51 1 1 Add a comment 4

  17. .NET Modern Task Scheduler : r/dotnet

    .NET Modern Task Scheduler A few years ago, I opened a GitHub issue with Microsoft telling them that I think the .NET ecosystem needs its own equivalent of Apache Airflow or Prefect. Fast forward 'til now, and I still don't think we have anything close to these frameworks.

  18. A decent task scheduling library for .NET? : r/dotnet

    Could someone help me out? I'm looking for a task scheduling library that allows for: - changing job settings at runtime without restarting (frequency, maybe params) - turn add/remove jobs without restarting. - block parallel jobs (if a job runs every minute, but takes 3 minutes to finish - so they don't collide) - allow for multiple jobs of ...

  19. Why is TaskScheduler.Current the default TaskScheduler?

    However, the TaskFactory behind Task.Factory is created as follows: s_factory = new TaskFactory (); As you can see, no TaskScheduler is specified; null is used for the default constructor - better would be TaskScheduler.Default (the documentation states that "Current" is used which has the same consequences).

  20. Task Parallel Library (TPL)

    The Task Parallel Library (TPL) is a set of public types and APIs in the System.Threading and System.Threading.Tasks namespaces. The purpose of the TPL is to make developers more productive by simplifying the process of adding parallelism and concurrency to applications.

  21. c#

    Now I'm using .Net 5 and I'm wondering if there is a new way to schedule tasks, like the worker service or it's still better and more flexible to use Quartz.Net. Since I need to run long time tasks, from 30s to 2 hrs, I need to create a timed background task, using System.Threading.Timer. The code should be the following: