Add a scheduled task at the setup?

2019-01-23 18:04发布

问题:

I've a little c# application, and I have to create a scheduled task for this application.

I have a Setup which installs the application, and the best case will be that I can set this windows scheduled task at the installation.

Any idea if it's possible and/or how?

Thank you very much

回答1:

There is a Task Scheduler Managed Wrapper on codeplex - this can be used to create a small console application that will setup a task and can be run by your installer.

You can also run the schtasks command line utility for a similar result.



回答2:

This may not be a whole answer, but depending on the installer (for example I think wise does it) you can setup tasks from there. Otherwise, you could call your app with a special commandline parameter to do so and utilise the api http://msdn.microsoft.com/en-us/library/aa383614.aspx as a possibility