1

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?

Vercas
  • 8,931
  • 15
  • 66
  • 106
  • 1
    possible 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
  • 1
    NOT 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 Answers2

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
  • 25,414
  • 13
  • 85
  • 121
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
  • 16,087
  • 8
  • 51
  • 67