什么是 Windows 版本的 cron?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/132971/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:23:29  来源:igfitidea点击:

What is the Windows version of cron?

windowscronschedulingscheduled-tasks

提问by Thomas Owens

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

一个谷歌搜索变成了软件执行相同功能的cron,但没有内置到Windows。

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

我正在运行 Windows XP Professional,但是对于任何版本的 Windows 的建议都可能对某人有所帮助。

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

是否还有一种方法可以以编程方式或通过命令行调用此功能(基于答案称为任务计划程序)?

回答by Kris Kumler

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

对于最初的问题,询问 Windows XP(和 Windows 7):Windows Task Scheduler

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

对于命令行使用,您可以使用AT 命令进行调度。

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

对于较新的 Microsoft 操作系统版本,Windows Server 2012 / Windows 8,请查看schtasks命令行实用程序。
如果使用 PowerShell,则Windows PowerShell中的计划任务 Cmdlet用于编写脚本。

回答by stephenbayer

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

Windows的“AT”命令是非常相似的cron。它可以通过命令行获得。

回答by user816347

pycronis close match on Windows. The following entries are supported:

pycron在 Windows 上非常匹配。支持以下条目:

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

回答by Dror Helper

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

使用 Windows 任务计划程序按时间和日期安排任务。

回答by leppie

The 'at' command.

'at' 命令。

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

“AT 命令调度命令和程序在指定的时间和日期在计算机上运行。调度服务必须正在运行才能使用 AT 命令。”

回答by Adam Mitz

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

是否还有一种方法可以以编程方式调用此功能(基于答案称为任务计划程序)[...]?

Task scheduler APIon MSDN.

MSDN 上的任务调度程序API

回答by ckramer

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

最接近的等效项是 Windows 计划任务(控制面板 -> 计划任务),尽管它们与 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.

最大的区别(对我而言)是它们需要用户登录到 Windows 框和用户帐户(带有密码和所有内容),如果您的本地安全策略需要定期更改密码,这将使事情成为一场噩梦。我还认为,就设置项目运行的间隔而言,它不如 cron 灵活。

回答by Zsolt Botykai

Zcronis available free for personal use.

Zcron可供个人免费使用。

回答by Przemek Kryger

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

不完全是 Windows 版本,但是您可以使用 Cygwin 的 crontab。有关安装说明,请参见此处:此处

回答by enobrev

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

如果您更喜欢好的 ol' cron,CRONw是您的最佳选择。

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