Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a desktop application(C#.NET), where I call a web service.

I need to invoke the C#.NET application from the Windows Task Scheduler, because I have to plan an execution four times a day.

How can I do this?

share|improve this question

migrated from Mar 16 '10 at 12:48

This question came from our site for professional and enthusiast programmers.

Are you asking how to achieve this programmatically, or are you simply asking for guidance on how to add scheduled tasks in Windows? – gpmcadam Mar 16 '10 at 7:14
@Bauer: Thanks. No I will use the Windows Task Scheduler. But I don't how to add my desktop application into task scheduler, so that it will run automatically when system is on.Hope you are getting my point. – purnang.advant Mar 16 '10 at 7:24
the above comments are confusing. so, wait, you want to do this manually? Well, then the answers work. If not, the question belongs on SO, but it was already migrated here. On another note, there's a pretty easy-to-use library out there for C# that I've used before to programatically add an entry into the task scheduler. – Maxim Zaslavsky Mar 16 '10 at 13:02

Start->Programs->Accessories->Scheduled Tasks

Click the Add Task Button..

Click Next, Select browse...

Find your .exe in your MyDocuments/VisualStudio2008/Porjects/NameOfProject/Debug/bin/yourfile.exe (most likely here)

Follow the wizard to the end.

share|improve this answer

windows comes with a task scheduler, use that!

considerations: assuming your desktop app can run "headless" and will terminate after execution

share|improve this answer
@lexu: Thanks , but i don't know the way to add c# application to windows task scheduler,Please advice me how to terminate the application after execution. I want to run my application everyday (two hours of interval) – purnang.advant Mar 16 '10 at 7:30
@purnang.advant: a c# app is an executable (thingy.exe) .. google for windows task scheduler and you will find better advice than I can provide. Look into writing a console app or a windows service for best results regarding the termination issue. – lexu Mar 16 '10 at 7:40

You must log in to answer this question.