Using Visual Studio and C# I am trying to create a single program that can schedule a task in the Windows Task Scheduler and tell it to execute a portion of code / a function in the program.
Issue - From what it seems like, I need 2 programs -
- The program to create the scheduled task
- The program the task scheduler runs
However, I would like the user to only need to install 1 program, and then within that program it can create a task, as well as execute a program / script.
For creating the task I am using the Task Scheduler Managed Wrapper - Creating Scheduled Tasks
And from that question I can see the user creates a task that runs a .exe
. Is there anyway to get that to run a portion of the code in the current program? Or is there a way that I can create 2 executables that can both go under one installation?
Just not really sure how to approach this, so any help is appreciated.