What is the Windows version of cron? [closed]

隐身守侯 提交于 2019-11-25 21:48:59

问题


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?


回答1:


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

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

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.




回答2:


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




回答3:


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



回答4:


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."




回答5:


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




回答6:


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.




回答8:


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




回答9:


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



回答10:


Zcron is available free for personal use.




回答11:


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




回答12:


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.




回答13:


The At command is now deprecated

you can use the SCHTASKS




回答14:


  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.

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




回答15:


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.



来源:https://stackoverflow.com/questions/132971/what-is-the-windows-version-of-cron

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!