How can I run a C# application from the Window Task Scheduler?

2

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?

purnang.advant

Posted 2010-03-16T07:11:30.273

Reputation:

1Are you asking how to achieve this programmatically, or are you simply asking for guidance on how to add scheduled tasks in Windows? – gpmcadam – 2010-03-16T07:14:36.760

@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. – None – 2010-03-16T07:24:57.263

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 – 2010-03-16T13:02:22.653

Answers

3

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.

Jason

Posted 2010-03-16T07:11:30.273

Reputation: 199

0

windows comes with a task scheduler, use that!

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

lexu

Posted 2010-03-16T07:11:30.273

Reputation: 1 822

@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) – None – 2010-03-16T07:30:23.423

@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 – 2010-03-16T07:40:21.807