297

A Google search turned up software that performs the same functions as cron, but nothing built into Windows.

I'm running Windows XP Professional, but advice for any version of Windows would be potentially helpful to someone.

Is there also a way to invoke this feature (which based on answers is called the Task Scheduler) programatically or via the command line?

3
  • 5
    What feature of cron do you need that Task Scheduler doesn't provide? Sep 25, 2008 at 12:24
  • 2
    Cron emails stdout and stderr to the user -- how do we do that in Task Scheduler? Feb 28, 2018 at 14:40
  • @user3450049: You allway can add a task in actions section to send logs by mail. You can use from a Telnet o Sendmail as fit your convenience. See stackoverflow.com/questions/18652001/send-mail-via-cmd-console
    – 0zkr PM
    Jul 10, 2019 at 16:45

15 Answers 15

308

For newer Microsoft OS versions, Windows Server 2012 / Windows 8, look at the schtasks command line utility.
If using PowerShell, the Scheduled Tasks Cmdlets in Windows PowerShell are made for scripting.

For command-line usage before Windows 8, you can schedule with the AT command.

For the original question, asking about Windows XP (and Windows 7): Windows Task Scheduler

9
  • 14
    In Windows 10 at.exe is deprecated and won't run. schtasks.exe is difficult to use (e.g. won't run without admin privileges) and bugged (e.g. the /Z switch). Nov 19, 2015 at 11:37
  • what about windows 7?
    – Tarik
    Dec 13, 2015 at 18:29
  • @Tarik Windows 7 will support the Task Scheduler as well. Dec 14, 2015 at 16:47
  • My windows 7 cmd has AT and schtasks. Is there a difference/preference? Why have both?
    – jiggunjer
    Aug 3, 2016 at 1:39
  • 10
    The Task Scheduler is such a dumpster fire of a piece of sofware. Everytime I open it there's a 50/50 chance it'll drop the framerate for the entire computer down to 3fps while trying to load a table view of like 6 items Apr 14, 2018 at 5:50
28

The Windows "AT" command is very similar to cron. It is available through the command line.

2
12

Use the Windows Task Scheduler to schedule tasks over time and dates.

11

pycron is close match on Windows. The following entries are supported:

1    Minute (0-59)
2    Hour (2-24)
3    Day of month (1-31)
4    Month (1-12, Jan, Feb, etc)
5    Day of week (0-6) 0 = Sunday, 1 = Monday etc or Sun, Mon, etc)
6    User that the command will run as
7    Command to execute
2
  • 1
    This is not a conmmand-line tools. As I see, it only check if current time match your settings.
    – Mithril
    Jun 19, 2018 at 3:04
  • This is merely a parser, it does not execute the tasks. Jul 1, 2019 at 7:24
10

The 'at' command.

"The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command."

1
  • depreciated, use schtasks.exe.
    – keramat
    Apr 15, 2020 at 9:15
8

Zcron is available free for personal use.

2
  • Z-Cron excactly.
    – fx-kirin
    Sep 12, 2017 at 7:35
  • it only allows cronjobs with 5 minutes interval. Jul 20, 2020 at 17:33
7

Is there also a way to invoke this feature (which based on answers is called the Task Scheduler) programatically [...]?

Task scheduler API on MSDN.

7

The closest equivalent are the Windows Scheduled Tasks (Control Panel -> Scheduled Tasks), though they are a far, far cry from cron.

The biggest difference (to me) is that they require a user to be logged into the Windows box, and a user account (with password and all), which makes things a nightmare if your local security policy requires password changes periodically. I also think it is less flexible than cron as far as setting intervals for items to run.

2
  • 2
    While cron is definitely superior to Windows tasks, you can actually use the computers 'SYSTEM' account which doesn't require a password and has full permissions to the local computer. Though this obviously has issues if you utilize external resources (such as a shared drive that requires domain creds). Apr 6, 2017 at 3:13
  • @SteveBauman The key is LOCAL RESOURCES, Windows might have the best task scheduler ever but if those task can only work on local resources it is 100% useless if you need to do something as simple as copy a backup to the local PC on a schedule.
    – krowe2
    Feb 13, 2018 at 20:02
6

Not exactly a Windows version, however you can use Cygwin's crontab. For install instructions, see here: here.

1
6

If you prefer good ol' cron, CRONw is the way to go.

Supported systems

* Windows 2000 (any version)    works
* Windows XP (SP 2)             works
* Windows Server 2003           works
* Windows NT 4 (SP 6)           should work but not tested
* Windows 3.11, Windows 95,
  Windows 98, Windows ME,
  Windows XP beneath SP2        not supported by design
4
  • 1
    I tried this one, and when I finally installed it and tried to test it, all I got was this message: We were asked to go - so I'm out finally... Any command I tried sent me that message. WTF? Is this project not active anymore or what's the meaning of that message?? THANKS
    – Metafaniel
    Mar 9, 2015 at 19:08
  • 1
    @Metafaniel, I haven't had a Windows system in about 4 or 5 years, so I haven't really kept up. Googling that response only leads me to this page and I don't see anything on their site about shutting down. Looking at the sourceforge repo, it looks like it hasn't changed in about a decade, so I'm wondering if maybe there's some sort of conflict on your local system? Considering it's been that long since the last update, I would definitely say it's no longer active, though that is a really strange response.
    – enobrev
    Mar 10, 2015 at 20:39
  • 1
    @Metafaniel I also downloaded and grepped the codebase for that message and found nothing. Good luck figuring out what's going on!
    – enobrev
    Mar 10, 2015 at 20:40
  • 1
    @Metafaniel As mentioned in the post, for Windows beyond XP SP2 it is not supported.
    – LoMaPh
    Dec 7, 2018 at 22:42
6

There is NNCron for Windows. IT can schedule jobs to be run periodically.

2

In addition to Windows Task Scheduler you also have 'at' on Windows. I'm not sure how it differs from Task Scheduler besides the fact that it has a command line interface.

1

The At command is now deprecated

you can use the SCHTASKS

0
1
  1. You can use the Scheduled-Tasks API in PowerShell along with a config.json file for parameters input. I guess the minimum limitation is 5 minutes. A sample tutorial for very basic Schedule Tasks creation via APIs

  2. You can use the schtasks.exe via cmd too. I could see the minute modifier limitation to 1 minute on executing schtasks.exe /Create /?. Anyways AT is now deprecated.

enter image description here

Anyways, I am working on a tool to behave like CRON. I will update here if it is successfull.

1

Check out the excellent Cronical program at https://github.com/mgefvert/Cronical

It is a .NET program that reads a text file with unix-like cron lines. Very convenient to use. It will send emails if stdout just like unix cron. It even supports acting as the service runner.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.