I must make a new Scheduled Task to start an application on windows startup.
Just like placing it in the "Startup" folder...
But I need to create, enable and disable this task in C#.
How do I do this?
Asked
Active
Viewed 2,297 times
1
Vercas
- 8,667
- 15
- 63
- 105
-
1possible duplicate of [How do I set a program to launch at startup.](http://stackoverflow.com/questions/674628/how-do-i-set-a-program-to-launch-at-startup) – Fosco Jun 24 '11 at 16:49
-
1NOT the same thing. I need not to place it in the startup folder, put it in a registry or make it a Windows Service. I need a task. – Vercas Jun 24 '11 at 16:50
2 Answers
2
There is a Task Scheduler library available on codeproject.com that might do what you need: http://www.codeproject.com/KB/cs/tsnewlib.aspx
Its an older library that may or may not work with newer versions of windows. At the very least, it should point you in the right direction.
Kyle Trauberman
- 24,976
- 13
- 86
- 117
1
I would recommend doing this as a windows service. It gives you the most control over the life cycle of a task like this. Here is a detailed tutorial. There is also a great wizard in Visual Studio to get you going in a few minutes.
I usually like to create a debug service using the sc tool (see tutorial) that points directly to your debug object as a means of easy debugging.
AdamC
- 15,761
- 7
- 48
- 66