Sleepy
Sleepy

Reputation: 93

Console Application versus Windows Service

I have a small C# program that I created that contacts a web service and retrieves and processes datasets. No problem with that after some head scratching and much exploring of stackOverflow - thanks to all who contribute.

I normally work in the Linux world, so this is a rare foray into the Windows Environment. What I need to do is set it up so that TaskScheduler will run this application. There is no console display or interaction, everything is written to log files.

In Linux I would simply use a CRONTASK, but things are a bit different in Windows. Is this the ?proper? way to do this since it will be run once daily? I considered a windows service but there is a level of complexity that I am not sure is justified.

Thoughts?

Upvotes: 5

Views: 2036

Answers (2)

Alex
Alex

Reputation: 2382

you will probably script this, so use schtasks.exe to create your scheduled tasks: msdn link to schtasks.exe

also, on win7 and later, you can actually migrate the created scheduled tasks in form of xml and import them onto another machine, it's a little easier to manipulate and/or save them if you want.

Upvotes: 1

Antony Scott
Antony Scott

Reputation: 21998

If your app is doing small task every so often then a scheduled task is better as you'd be taking up system resources with a service sitting there doing nothing for most of the time.

If you're running your app on a recent version of windows then take a look in the control panel and search for "scheduled tasks". You will be able to set up a job to run your app daily in there.

Upvotes: 6

Related Questions