开发者

Set up a scheduled task programmatically

开发者 https://www.devze.com 2023-02-19 08:54 出处:网络
My application needs to set up a scheduled task on installation. The task is to run my program on several triggers (related to logon events). I am wondering what is the easiest way to do this? S开发者

My application needs to set up a scheduled task on installation. The task is to run my program on several triggers (related to logon events). I am wondering what is the easiest way to do this? S开发者_运维知识库hould I use a batch file?

This program will run only on Windows 7.


That sounds more like a WindowsService than a scheduled task. The SystemEvents Class documentation includes an example of setting up a WindowsService that will then monitor for various system events (including SessionEnding and SessionSwitch). Monitoring for logon events would be difficult as you have something of a chicken/egg problem there. On the other hand, adding an application to run on startup is relatively simple and would let you know that a user has logged on...

0

精彩评论

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

关注公众号