C# API for Task Scheduler 2.0

C# API for Task Scheduler 2.0

See the following project on GitHub:

https://github.com/dahall/taskscheduler

How to execute .Net Core 2.0 Console App using Windows Task Scheduler?

Just call dotnet and pass in dll you wish to run as argument. You can either specify the full path in the argument or set the path where your dll resides in the "Start in" field. You should use the published dll and NOT the development dll that gets created in the project's bin folder.

Task Scheduler Start DLL

Schedule task in Windows Task Scheduler C#

Well, I suppose you don't know about the schtasks command.

You could simply open a command prompt and type schtasks /? to see the options available.

The one needed here is /create. Of course this option requires a series of parameter to configure your scheduled task. But at the end you could resolve all calling:

Process.Start("schtasks", commandParams);

For the close process part, I use a little utility called pskill found in the Sysinternals suite from Microsoft's Mark Russinovich. Also this could be called inside a batch file set as scheduled task.

EDIT: Changed from psshutdown to pskill (You need to close only your app right?)



Related Topics



Leave a reply



Submit