UiPath Documentation
robot
latest
false
重要 :
新发布内容的本地化可能需要 1-2 周的时间才能完成。

机器人管理员指南

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

Robot 命令行界面

UiPath 机器人命令行接口是一个工具,让您能够通过命令行终端与机器人交互。它使用 UiRobot.exe 文件,可直接通过命令行启动、停止或监控 Attended 和 Unattended 自动化。您还可以获取有关已安装包的详细信息、创建日志或更新配置。

工作方式

要使用 CLI,请确保以下方面:

  • UiPath 机器人服务正在运行
  • 您位于安装机器人的目录中。

然后,根据您希望自动化实现的目标,键入引用 UiRobot.exe 程序的说明或命令以及必要的参数。

例如,要通过命令行启动流程,您可以使用以下命令:

UiRobot.exe -file "C:\UiPath\Projects\YourProject\Main.xaml".
UiRobot.exe -file "C:\UiPath\Projects\YourProject\Main.xaml".

常用 UiRobot.exe 命令

执行

使用此命令即可开始执行以下类型的项目文件:

  • JSON
  • XAML
  • NUPKG
备注:

对于 2023.4 及更高版本的机器人,UiPath 会在执行流程的同时刷新流程列表。如果作业开始时有可用的流程更新,则作业将使用流程的旧版本。后续运行将应用更新后的流程。

该执行命令使用以下参数:

UiRobot.exe execute [--process <Package_ID> | --file <File_Path>] [--folder <Orchestrator_Folder_ID>] [--input <Input_Parameters>]
UiRobot.exe execute [--process <Package_ID> | --file <File_Path>] [--folder <Orchestrator_Folder_ID>] [--input <Input_Parameters>]
  • -p--process <Package_ID>(必填)- 开始执行本地或 Orchestrator 流程。

    示例:

    UiRobot.exe execute --process UiPathDemoProcess
    UiRobot.exe execute --process UiPathDemoProcess
    
    UiRobot.exe execute -p UiPathDemoProcess
    UiRobot.exe execute -p UiPathDemoProcess
    
  • -f--file <File_Path>(必填)- 开始执行本地项目文件。目标文件可以是 JSON、XAML 或 NUPKG 格式。

    示例:

    UiRobot.exe execute --file "C:\UiPath\Automation\Project.json"
    UiRobot.exe execute --file "C:\UiPath\Automation\Project.json"
    
    UiRobot.exe execute --file "C:\UiPath\Automation\Project.json"
    UiRobot.exe execute --file "C:\UiPath\Automation\Project.json"
    
    UiRobot.exe execute --file "C:\UiPath\Automation\Project.json"
    UiRobot.exe execute --file "C:\UiPath\Automation\Project.json"
    
  • --folder <Orchestrator_Folder_ID>(可选)- 允许您指定 Orchestrator 文件夹,以便在此文件夹中安装和执行目标流程。此参数仅可与 --process 参数搭配使用。

    示例:

    UiRobot.exe -Execute --process UiPathDemoProcess --folder OrchFolder1
    UiRobot.exe -Execute --process UiPathDemoProcess --folder OrchFolder1
    
  • --input <Input_Parameters> (可选) - 用于指定要执行的输入参数。 它可以与--process--file参数一起使用。

    示例:

    UiRobot.exe execute --process UiPathDemoProcess --input "{'inArg' : 'value' , 'Integer' : 3}"
    UiRobot.exe execute --process UiPathDemoProcess --input "{'inArg' : 'value' , 'Integer' : 3}"
    
    UiRobot.exe execute --process UiPathDemoProcess --folder OrchFolder1 --input "{'inArg' : 'value' , 'Integer' : 3}"
    UiRobot.exe execute --process UiPathDemoProcess --folder OrchFolder1 --input "{'inArg' : 'value' , 'Integer' : 3}"
    
    UiRobot.exe execute --file "C:\UiPath\Automation\Main.xaml" --input "{'inArg' : 'value' , 'Integer' : 3}"
    UiRobot.exe execute --file "C:\UiPath\Automation\Main.xaml" --input "{'inArg' : 'value' , 'Integer' : 3}"
    
  • --entry <entrypoint>(可选)- 允许您在通过命令行启动流程时选择流程的入口点。

    示例:

    UiRobot execute --file "C:\UiPath\Project\project.1.0.3.nupkg" --input "{'inArg':'value','integer':3}" --entry "OtherEntryPoint.xaml"
    UiRobot execute --file "C:\UiPath\Project\project.1.0.3.nupkg" --input "{'inArg':'value','integer':3}" --entry "OtherEntryPoint.xaml"
    
    重要提示:
    • Windows 或跨平台项目不支持以下命令:
    UiRobot.exe execute --file "C:\UiPath\Automation\Main.xaml"
    UiRobot.exe execute --file "C:\UiPath\Automation\Main.xaml"
    
    UiRobot.exe execute --file "C:\UiPath\Automation\Project.json"
    UiRobot.exe execute --file "C:\UiPath\Automation\Project.json"
    
    • 不能在执行命令中同时使用 --process (-p)--file (-f) 参数。

安装流程

使用此命令即可安装流程。如果机器人已连接到 Orchestrator,它会在 Orchestrator 订阅源中搜索流程。如果还没有连接 Orchestrator,机器人将使用本地订阅源。

安装流程命令使用以下参数:

UiRobot.exe installprocess [--process-name <process_name>] [--folder <orchestrator_folder>]
UiRobot.exe installprocess [--process-name <process_name>] [--folder <orchestrator_folder>]
  • --process-name <process_name>(必填)- 要安装的流程的名称。

    示例:

    UiRobot installprocess --process-name MyProcess
    UiRobot installprocess --process-name MyProcess
    
  • --folder <orchestrator_folder> (可选) - 包含要安装的流程的 Orchestrator 文件夹的名称。 仅当与 Orchestrator 的连接处于活动状态时,此参数才适用。 如果只有一个文件夹包含安装流程,请跳过此参数。

    示例:

    UiRobot installprocess -p MyProcess --folder MyOrchestratorFolder
    UiRobot installprocess -p MyProcess --folder MyOrchestratorFolder
    

连接

使用此命令将机器人连接到 Orchestrator 实例。如果您在机器人已连接到 Orchestrator 的情况下运行此命令,它将返回“Orchestrator 已连接”消息。

连接命令使用以下参数:

UiRobot.exe connect [--url <Orchestrator_Server_URL> --key <Machine_Key>] | [--connectionString <Connection_String>]
UiRobot.exe connect [--url <Orchestrator_Server_URL> --key <Machine_Key>] | [--connectionString <Connection_String>]
  • connect - 建立与 Orchestrator 的连接。 必须将 --url--key--clientID --clientSecret 参数一起使用。 如果未指定这些参数,则命令将使用 Orchestrator 设置配置。

    示例:

    // no arguments
    
    UiRobot.exe connect
    // no arguments
    
    UiRobot.exe connect
    
    //using the machine key
    
    UiRobot.exe connect --url https://demo.uipath.com/ --key 1122AAB3C-DD44-ABCD-1234-7788GG99HH00
    //using the machine key
    
    UiRobot.exe connect --url https://demo.uipath.com/ --key 1122AAB3C-DD44-ABCD-1234-7788GG99HH00
    
    //using the client ID and secret
    
    UiRobot.exe connect --url https://demo.uipath.com/ --clientID 696CCA0C-1234-ABCD-1234-F65BBC2F15DE --clientSecret QJX!jv12345A4q4N
    //using the client ID and secret
    
    UiRobot.exe connect --url https://demo.uipath.com/ --clientID 696CCA0C-1234-ABCD-1234-F65BBC2F15DE --clientSecret QJX!jv12345A4q4N
    

断开连接

使用此命令可断开机器人与当前 Orchestrator 实例的连接。

断开连接命令使用以下参数:

UiRobot.exe disconnect --force | --wait
UiRobot.exe disconnect --force | --wait
  • disconnect - 仅当机器人计算机上没有正在运行的作业时,才断开机器人与 Orchestrator 的连接。

    示例:

    UiRobot.exe disconnect
    UiRobot.exe disconnect
    
  • --force - 终止计算机上正在运行的所有作业,然后断开机器人与 Orchestrator 的连接。

    示例:

    UiRobot.exe disconnect --force
    UiRobot.exe disconnect --force
    
  • --wait - 等待正在运行的作业完成,然后再断开机器人与 Orchestrator 的连接。

    示例:

    UiRobot.exe disconnect --wait
    UiRobot.exe disconnect --wait
    

追踪

使用此命令可为机器人启用或禁用低级别追踪。

追踪命令使用以下参数:

UiRobot.exe trace --enableLowLevel | --disableLowLevel
UiRobot.exe trace --enableLowLevel | --disableLowLevel
  • --enableLowLevel - 在“事件查看器”中为机器人执行程序和服务启用 Verbose 追踪。它会生成一个 ETL 文件,您可以使用事件查看器打开该文件,以帮助对崩溃和错误进行故障排除。

    示例:

    UiRobot.exe trace --enableLowLevel
    UiRobot.exe trace --enableLowLevel
    
  • --disableLowLevel - 为机器人执行程序和服务禁用 Verbose 追踪功能。该功能会生成一个 ETL 文件,您可以使用“事件查看器”打开该文件,以在对崩溃和错误进行故障排除时获得帮助。

    示例:

    UiRobot.exe trace --disableLowLevel
    UiRobot.exe trace --disableLowLevel
    

PiP

使用此命令可在计算机上启用或禁用机器人会话或画中画功能。此设置会修改现有安装并被应用于本地计算机上的所有用户。需要管理员权限。

PiP 命令使用以下参数:

UiRobot.exe pip --enable | --disable
UiRobot.exe pip --enable | --disable
  • --enable - 启用计算机的机器人会话(PiP 功能)。

    示例:

    UiRobot.exe pip --enable
    UiRobot.exe pip --enable
    
  • --disable - 禁用计算机的机器人会话(PiP 功能)。

    示例:

    UiRobot.exe pip --disable
    UiRobot.exe pip --disable
    

清理 NuGet 缓存

使用此命令清理 NuGet 缓存:全局包缓存(此为还原的.nupkg内容)和 HTTP 缓存(NuGet 订阅源响应缓存)。在此操作期间,作业不应运行。

清理 NuGet 缓存命令使用以下参数:

UiRobot.exe cleannugetcache [--period <period_in_days>] [--timeout <timeout_in_minutes>] [--allow-unsafe]
UiRobot.exe cleannugetcache [--period <period_in_days>] [--timeout <timeout_in_minutes>] [--allow-unsafe]
  • -p --period <period_in_days>可选,默认为30 )- 删除.nupkg.metadata文件在过去 X 天内无人访问的全局包条目。始终删除过时或损坏的包文件夹(缺少.nupkg.metadata )。无论此值如何,HTTP 缓存都将被完全擦除。必须大于0

    示例:

    UiRobot.exe cleannugetcache --period 60
    UiRobot.exe cleannugetcache --period 60
    
  • -t --timeout <timeout_in_minutes>可选,默认为10 )- 允许运行清理的最长时间(以分钟为单位)。当超时过期时,系统将取消该操作并打印部分摘要。

    示例:

    UiRobot.exe cleannugetcache --timeout 20
    UiRobot.exe cleannugetcache --timeout 20
    
  • --allow-unsafe (可选,默认为false )- 默认情况下,如果机器人配置为使用自定义 NuGet globalPackagesFolder (可能与其他用户共享的文件夹),则该命令拒绝运行。使用此标志强制清理该自定义文件夹。

    重要提示:

    清理共享的全局包文件夹可能会中断正在运行的作业或属于其他用户共享该文件夹的应用程序。

    示例:

    UiRobot.exe cleannugetcache --period 30 --allow-unsafe
    UiRobot.exe cleannugetcache --period 30 --allow-unsafe
    

该命令将打印清理的摘要,按global-packageshttp-cache细分,包括匹配的条目总数中已删除的条目数量。

设置代理基本身份验证凭据

使用此命令可为当前用户设置代理基本身份验证凭据。凭据在本地保留,并由机器人在通过需要基本身份验证的代理进行通信时使用。

set Proxy 命令使用以下参数:

UiRobot.exe setproxy --username <user> --password <password> [--domain <domain>]
UiRobot.exe setproxy --username <user> --password <password> [--domain <domain>]
  • --username <user> (必填)- 用于代理基本身份验证的用户名。

  • --password <password> (必需)- 用于代理基本身份验证的密码。

    示例:

    UiRobot.exe setproxy --username myuser --password mypassword
    UiRobot.exe setproxy --username myuser --password mypassword
    
  • --domain <domain> (可选)- 用于代理基本身份验证的域。当代理需要域限定凭据时,请使用此选项。

    示例:

    UiRobot.exe setproxy --username myuser --password mypassword --domain MYDOMAIN
    UiRobot.exe setproxy --username myuser --password mypassword --domain MYDOMAIN
    
重要提示:

运行该命令将覆盖任何先前存储的代理凭据。

其他参数

以下参数仅用于提供相关信息,对您的自动化项目没有任何影响:

  • --version - 显示有关机器人版本的信息。
  • --help - 显示受支持命令的列表,以及相应的信息和示例。
  • flushlogs [--timeout <timeout_in_seconds>] - 将所有待处理的日志发送到 Orchestrator。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新