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.
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
How to Parse Dates with a Suffix "Th", "St" or "Nd" on the Day of the Month
Visual Studio Installer > How to Launch App at End of Installer
Why Do C#'s Binary Operators Always Return Int Regardless of the Format of Their Inputs
What's Wrong with This Division
Use Local Images in Webbrowser Control
Best Way to Share Data Between Two Child Components in Blazor
JSON Deserialization - Map Array Indices to Properties with JSON.Net
How to Fix the Error:"Unreachable Code Detected"
How to Fill Part of Image with Color
How to Convert a File into Byte Array in Memory
ASP.NET Gridview: How to Edit and Delete Data Records
What Is the Default Value for Enum Variable
How to Redirect to Index from Another Controller
Project a Can't Reference a Class in Project B
Detecting Client Death in Wcf Duplex Contracts
Insert Datetime Value in SQL Database with C#
How to Tell If a Type Is a "Simple" Type? I.E. Holds a Single Value