Setting up a scheduled task in .Net

谁都会走 提交于 2019-11-28 12:20:36

The best thing is to not write a scheduler, but use the built-in Windows scheduler to run your code.

More info:

http://support.microsoft.com/kb/308569

Note: if you schedule a task to run under an account other than your own, the application may not have access to network drives or some other resources. In other words, there may be some security challenges to work through, particularly for something like a backup app.

If this is just a personal app for backup, my recommendation would be to use XCOPY from a batch file rather than re-inventing the wheel.

As RichardTallent says, don't write your own; instead hook into the Windows scheduler. It's not too difficult.

We used the libraries and examples here and here. Easy to use. Kudos to Eduardo Morcillo and Eric Moreau for showing the way.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!