If we need to write a program that works periodically, which way do we prefer? Writing a windows service or writing a console application which works as scheduled task?
Start with a console app. Seperate the logic which would sit inside your loop-process-sleep loop, then you can actually switch between them easily - even in the same EXE.
I've done this. We could call:
ourservice.exe -console
and it'd just run. Or
ourservice.exe -install
and it'll install as a service :)
I'd go scheduled task in 99% of cases. If you need to run all the time, listen on ports, watch a folder (maybe - can be done every 10 seconds without a problem): then do it in a service. If all you do is wake up, do some processing (or not), and then go back to sleep: use the scheduler. It's easier, cleaner (memory management, esp if you are using COM objects, and REALLY if you are using MAPI), and the options (weekly, but not on tuesdays at 5pm) with the MS scheduler are better than you can write in the time..... which is NO time, as it already exists and is free
Oh, and it's easier to debug a console app (scheduler) than a service.... :) Or have someone "just run it".