dasun
dasun

Reputation: 25

how to set a program to run automatically once a day in c#

I am a newbie to programming So I need lot of support from my friends I am creating a windows forms application and I need that program to run automatically once a day and need to close itself after 2 minutes of the execution how to do it....

Upvotes: 0

Views: 1995

Answers (2)

Metallic Skeleton
Metallic Skeleton

Reputation: 699

I would like to take the below approach.

  1. Write console application. and add appropriate log message so that you can understand how it goes. if the application need any parameter then pass it from command line or put in a file so that the app can read the file and run automatically.

  2. Add the app to Windows schedule task and monitor log regularly.

if the input parameter changes everyday then just update the input file when necessary.

Hope it will give you a idea.

Thanks.

Ruhul

Upvotes: 2

Yeldar Kurmangaliyev
Yeldar Kurmangaliyev

Reputation: 34244

I need that program to run automatically once a day

You can use Windows Task Scheduler.

need to close itself after 2 minutes of the execution

You can implement in your application using many different approaches.
For instance, since you write WinForms applications, you can use Timer.

Upvotes: 6

Related Questions