The function of services is to monitor applications and/or folders as well as react to events. Unlike a scheduled task, a service is a program that executes in the background in its own Windows session. Hence, the API's capabilities are limited to whatever you can do via the Task Scheduler Window.NET Windows services take over where scheduled tasks leave off, giving us access to folder-specific events. The Task Scheduler 2.0 API exposes the functionality of the Task Scheduler so that you can dynamically create, modify, and remove scheduled tasks. I'll build the service using SharpDevelop 4.0, but you can use Visual Studio or another preferred IDE to do so.Īlthough there is some overlap between scheduled tasks and Windows services (originally introduced in Windows NT as NT Services), they are two distinct programming APIs. In this article, I will explain how to create a Windows service in C# that uses the FileSystemWatcher object to provide more granular file system monitoring than Task Scheduler allows. The FileSystemWatcher object allows you to monitor changes within a directory, specifically when files or folders are created, modified, deleted, or renamed. For those, you need to use the FileSystemWatcher object that comes with the. However, one thing that you can't do via a scheduled task is react to file system events. In addition to letting you schedule tasks on a recurring schedule, Task Scheduler 2.0 allows you to launch a process depending on a number of events, including custom ones. The Windows Task Scheduler has come far since its humble beginnings in Windows 2000.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |