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?
"It depends", but I usually prefer scheduled tasks, for simplicity:
If this is a more or less a one off, and something that you will install and controll yourself, a scheduled task is probably a good idea.
For something that should have the feel of a finished product, and the customer should install themselves, I would go with a Windows Service.
And the schedule is also an issue. The minimum schedule for a scheduled task is one minute. Anything below that, you either need to use a windows service, or build a loop into your job.