开发者

Start program with a Scheduled Task on startup with C#?

I must make a new Scheduled Task to start an application on windows startup.

J开发者_JS百科ust like placing it in the "Startup" folder...

But I need to create, enable and disable this task in C#.

How do I do this?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜