使用命令行定时触发机器人-UiPath
[TOC]
1. 系统操作
[window键+R键]->运行[run]窗口->输入:services.msc 点击确定(或按回车)打开服务
![](https://img.haomeiwen.com/i3269064/93ab44cf348679f1.png)
找到Task Scheduler
![](https://img.haomeiwen.com/i3269064/7485fcfbfe338435.png)
[开启服务] 双击打开服务→启动类型→设置成自动→应用
[关闭服务] 双击打开服务→启动类型→设置成禁用→应用
![](https://img.haomeiwen.com/i3269064/25e54e6b84d10909.png)
2. 定时任务设置
2.1 开启任务计划程序(Task scheduler)
-
方式一:
[开始]->[所有程序]->[附件]->[系统工具]->[任务计划程序(Task Scheduler)]
![](https://img.haomeiwen.com/i3269064/e91a801d14af5eb1.png)
- 方式二:
[搜索]->[查找任务计划程序(Task Scheduler)]->[ 任务计划程序(Task Scheduler)]
![](https://img.haomeiwen.com/i3269064/49b5571cf1570629.png)
任务计划程序(Task Scheduler)界面
![](https://img.haomeiwen.com/i3269064/2af1c1625f0ec6f6.png)
2.2 创建定时任务
[创建任务]<->[Create Task]
选择对应文件夹->右键->选择[Create Task]
![](https://img.haomeiwen.com/i3269064/b930e554eeecb1f7.png)
[常规]<->[General]
名称name->安全选项[Security options](勾选:只有用户登陆运行[Run only when user is logged on])
![](https://img.haomeiwen.com/i3269064/88f5ffa794f7ad03.png)
[触发器]<->[Triggers]
新建[New]->设置settings->确定[ok]
![](https://img.haomeiwen.com/i3269064/2494defcded94899.png)
[操作]<->[Actions]
新建[New]->设置[settings](程序或脚本: "UiPath.robot.exe程序路径"->-file "要运行的*.xaml文件路径" --monitor)->确定[ok]
运行脚本的命令行可以参考如下:
打包、连接Orchestrator的命令行及详解可以到RPA星球交流,微信扫描文档底部二维码加入。
通过命令行方式启动流程的语法
前提:进入到UiRobot所在目录"cd C:\Users\${user}\AppData\Local\UiPath\app-19.11.0-beta0002" ${user}需要替换为自己的用户名,app后面版本号根据自己的安装决定
使用方式: UiRobot execute [--process <package_id> | --file <file_path>] [--input <input_params>] [--folder <folder_path>]
示例:
UiRobot execute --process UiPathDemo
UiRobot execute --process UiPathDemo --folder "Product/Development/QA" --input "{'inArg':'value'}"
UiRobot execute --file "C:\UiPath\Project\project.json"
UiRobot execute --file "C:\UiPath\Project\Main.xaml" --input "{'inArg':'value','integer':3}"
UiRobot execute --file "C:\UiPath\Project\Notepad.1.0.6682.21636.nupkg"
C:\Users\xshe\AppData\Local\UiPath\app-19.9.0-beta0103\UiRobot.exe execute --file C:\Work\RPAProject\RPAUtils\SecureString.xaml
C:\Work\RPAProject\RPAUtils\DrawingPicture_Final\Main.xaml
C:\Users\xshe\AppData\Local\UiPath\app-19.9.0-beta0103\UiRobot.exe execute --file C:\Work\RPAProject\RPAUtils\DrawingPicture_Final\Main.xaml
![](https://img.haomeiwen.com/i3269064/f9ea0dfb4388ce96.png)
条件<->[Conditions]
全部不勾选
![](https://img.haomeiwen.com/i3269064/a1609c91ae2e5b9e.png)
设置<->[Settings]
勾选 允许按需运行[Allow task tobe on dwmard] 其余不勾选
选择将新实例排队[Queue a new instance]
![](https://img.haomeiwen.com/i3269064/f406bfa472d3360a.png)
确认[Ok]
![](https://img.haomeiwen.com/i3269064/d3abeec39895ea0e.png)
2.3 修改定时任务
任务计划程序库->选中自己的任务,右击->属性->在弹窗中修改(与创建一致)
![](https://img.haomeiwen.com/i3269064/d14d41c11b9cf8fc.png)
2.4 管理定时任务
通过左侧文件目录对定时任务进行归类
![](https://img.haomeiwen.com/i3269064/00029ffa03230818.png)
选择对应的定时任务->右下进行状态管理(运行[run],启动任务[enable],停止任务[disable]…)
![](https://img.haomeiwen.com/i3269064/46396ebbe949a02e.png)
2.5 监测运行状态
刷新[refresh]->查看最后一次运行状态[last Run result](成功运行会显示succeed,不成功则显示 (0×1))
![](https://img.haomeiwen.com/i3269064/80c7ddb2a8533e8d.png)
3. 加入RPA知识星球
现在加入星球,与RPA大牛一起学习