I run into a situation every couple of months where I need to develop a solution that's scheduled to run periodically, but I haven't found a way to handle this in Windows that I'm entirely happy with. Every time I do it, I end up feeling corralled into using a Windows Service, which seems to be an unacceptable amount of overhead for something I could do with a cron job in Unix.

Am I missing something here? What have you used to schedule an application in Windows?

+6  A: 

hate to point out the obvious, but you are familiar with Windows Scheduled Tasks, right?

Karl Seguin
+3  A: 

Use the at command


@Karl Yes, I am and I should have been clearer about something. I've been steered away from Scheduled Tasks from the people I work with towards Services, but have never really gotten a clear reason for this. I haven't been a heavy Windows user in about 10 years, and have only recently started developing for the platform, so I'm rather unfamiliar with the ups and downs of certain parts of it.

@sasb The at command is new to me and seems like it may be what I'm looking for. The links suggest it's for Windows 2000 and that it's been superseded by SCHTASKS. I'm guessing this is the command line window into the Scheduled Tasks piece in Windows.

+5  A: 

@saalon: Scheduled task is really the way to go for programs that start, execute, and stop (like running a backup script every day at 2am). Services are meant for programs that always run in the background (like IIS, or SQL Server).

The nice thing about a schedule task is it'll run any old executable on your given schedule. You don't need to do anything special (except make sure the executable runs without user interaction). Services require a special type of program, and typically require that you code extra-carefully, as this will run forever, so even a small memory leak can lead to problems over time.

Scheduled tasks are like crons.

Karl Seguin
+3  A: 

Yeah, SCHTASKS is a CLI for Windows Scheduled Tasks

+1  A: 

I've found the timer library from this codeproject page extremely useful.

It offers a wide variety of flexible schedule patterns include composable ones that efficiently use one timer.

It seems to scale well since I've had hundereds of timers running off it. Also, it's easy to add tasks with very customizable schedules (e.g. every tuesday between 10am and 7pm every 15 seconds).

+1  A: 

We use arcana sheduler and its pretty good! Worth checking

+2  A: 

You could use Task Scheduler API which comes with Windows:

Nick Brooks