UiPath Documentation
orchestrator
latest
false

Orchestrator 用户指南

上次更新日期 2026年5月11日

使用 CRON 表达式

CRON 是一个软件实用程序,存在于类 Unix 操作系统中,用于基于时间的计划。它使用由空格分隔的 6 个字段(如果包括年,则为 7 个字段)组成的字符串,提供高度可自定义的重复任务计划。字符串的格式为 seconds minutes hours day of the month month day of the week year

在 Orchestrator 中,cron 表达式基于使用后台任务的内部计划库,在使用“高级计划”选项创建时间触发器时需要用到这类表达式:

图 1. 高级计划选项

CRON 表达式中的每个字段都有一个指定的值范围和特殊字符,可用于创建计划,如下所述:

字段必需允许的值允许的特殊字符
seconds0 - 59, - * /
minutes0 - 59, - * /
hours0 - 23, - * /
day of the month1 - 31, - * / ? L W
month1 - 12 or JAN - DEC, - * /
day of the week1 - 7 or SUN - SAT, - * / ? L #
year空格或 1970 - 2099, - * /

可用特殊字符的含义和用法如下所示:

字符描述示例
*用于表示给定字段的所有值。* * * ? * * would trigger every second, whereas 0 * * ? * * would trigger every minute, more specifically at second 0 of each minute.
?用于表示未指定任何值。只能在 day of the monthday of the week 字段中使用。0 0 0 15 * ? * would trigger at midnight on the 15th day of each month, whereas 0 0 0 ? * 2 * would trigger at midnight each Monday.
-用于表示值范围。0 0 9-17 ? * 2-6 would trigger every hour from 9:00am until 5:00pm on Monday through Friday.
,用于表示附加值。0 0 9-17 ? * MON,WED,FRI would trigger every hour from 9:00am until 5:00pm on Mondays, Wednesdays, and Fridays.
/用于表示给定字段的增量。0 0 0/3 ? * 2/7 would trigger every three hours, on Mondays, beginning at midnight.
L用于表示“Last”。只能在 day of the monthday of the week 字段中使用。对于 day of the week,可以在另一个值后面使用(例如 6L)来表示上星期五。59 59 23 L * ? would trigger at 11:59:59pm on the last day of each month, whereas 59 59 23 ? * 6L would trigger at the same time but only on the last Friday of each month.
W用于表示距给定值最近的工作日。只能在 day of the month 字段中使用。0 0 0 15W * ? would trigger at midnight of the nearest weekday to the 15th, every month. If the 15th is a Saturday, it would trigger on Friday the 14th, whereas if the 15th is Sunday, it will trigger on Monday the 16th.
#用于表示给定值的每月出现次数,例如第一个星期五或第四个星期四。只能在 day of the week 字段中使用。0 0 17 ? * 6#1 would trigger at 5:00pm on the first Friday of every month.

示例

下表显示了常见的计划表达式。由于day of the week字段对星期日使用1 ,对星期六使用7 ,因此表示星期一至星期五的2-6等表达式与星期日为0的实现不同。

表达式描述
0 0 12 ? * *每天中午
0 30 8 ? * 2-6每个工作日(周一至周五)上午 8:30
0 0 9,17 ? * 2-6每个工作日上午 9:00 和下午 5:00
0 0,30 10-18 ? * 2-6星期一至星期五上午 10:00 至下午 6:30 每 30 分钟一次
0 0/15 * ? * *全天候,每 15 分钟一次
0 0 0/6 ? * *从午夜开始每 6 小时(午夜、上午 6:00、中午和下午 6:00)
0 0 9 ? * 2每个星期一上午 9:00
0 0 8 1 * ?每月第一天 上午 8:00
0 0 0 L * ?每月最后一天的午夜
0 0 17 ? * 6#1每个月的第一个星期五的下午 5:00
  • 示例

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新