UiPath Documentation
robot
2026.10
false
机器人管理员指南

Robot 命令行界面

Robot Command Line Interface (UiRobot.exe) for starting automations, connecting to Orchestrator, and managing the Robot from a terminal.

The UiPath Robot Command Line Interface is a tool that allows you to interact with the Robot from a command line terminal. It uses the UiRobot.exe file to start automations, install processes, connect and disconnect the Robot from Orchestrator, and manage logs, tracing, the Robot session (PiP), proxy credentials, and the NuGet cache directly from the command line.

工作方式​

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

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

Then enter instructions or commands that refer to the UiRobot.exe program along with the necessary parameters, depending on what you want your automation to achieve.

UiRobot.exe is in the Robot installation folder: %ProgramFiles%\UiPathPlatform\Robot\<version> for a per-machine installation, or %LocalAppData%\Programs\UiPathPlatform\Robot\<version> for a per-user installation.

Command and option names aren't case-sensitive.

When the Robot runs in service mode, the connect, disconnect, and flushlogs commands require an elevated command prompt (run as administrator).

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

UiRobot.exe execute --file "C:\UiPath\Projects\YourProject\project.1.0.0.nupkg"
UiRobot.exe execute --file "C:\UiPath\Projects\YourProject\project.1.0.0.nupkg"

常用 UiRobot.exe 命令​

执行​

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

  • NUPKG
  • JSON (legacy projects only)
  • XAML (legacy projects only)
备注:

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

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

UiRobot.exe execute (--package-id <Package_ID> | --process-name <Process_Name> | --file <File_Path>) [--input <Input_Parameters>] [--folder <Orchestrator_Folder_Path>] [--entry <Entry_Point_Path>]
UiRobot.exe execute (--package-id <Package_ID> | --process-name <Process_Name> | --file <File_Path>) [--input <Input_Parameters>] [--folder <Orchestrator_Folder_Path>] [--entry <Entry_Point_Path>]

Use exactly one of --package-id, --process-name, and --file.

  • -p, --package-id <Package_ID> - Starts the process with this package ID, from the Orchestrator feed or the local feed. The Robot uses the available version of the package.

    示例:

    UiRobot.exe execute --package-id UiPathDemo
    UiRobot.exe execute --package-id UiPathDemo
    
    UiRobot.exe execute -p UiPathDemo
    UiRobot.exe execute -p UiPathDemo
    
  • -r, --process-name <Process_Name> - Starts the process with this name, as defined in Orchestrator.

    示例:

    UiRobot.exe execute --process-name UiPathDemoProcess
    UiRobot.exe execute --process-name UiPathDemoProcess
    
  • -f, --file <File_Path> - Starts the execution of a local project file. The target file can be NUPKG, or JSON or XAML for legacy projects only.

    示例:

    UiRobot.exe execute --file "C:\UiPath\Automation\project.1.0.0.nupkg"
    UiRobot.exe execute --file "C:\UiPath\Automation\project.1.0.0.nupkg"
    
  • --folder <Orchestrator_Folder_Path> (optional) - The path of the Orchestrator folder from which to install and execute the target process, such as Product/Development/QA. Required when the process is deployed in more than one folder.

    示例:

    UiRobot.exe execute --package-id UiPathDemo --folder "Product/Development/QA"
    UiRobot.exe execute --package-id UiPathDemo --folder "Product/Development/QA"
    
  • -i, --input <Input_Parameters> (optional) - Input arguments for the execution, in JSON format.

    示例:

    UiRobot.exe execute --package-id UiPathDemo --input "{\"intArg\" : 3, \"strArg\" : \"hello\"}"
    UiRobot.exe execute --package-id UiPathDemo --input "{\"intArg\" : 3, \"strArg\" : \"hello\"}"
    
    UiRobot.exe execute --file "C:\UiPath\Automation\project.1.0.0.nupkg" --input "{\"intArg\" : 3, \"strArg\" : \"hello\"}"
    UiRobot.exe execute --file "C:\UiPath\Automation\project.1.0.0.nupkg" --input "{\"intArg\" : 3, \"strArg\" : \"hello\"}"
    

    In PowerShell, enclose the JSON in single quotes: --input '{\"intArg\" : 3, \"strArg\" : \"hello\"}'.

  • --entry <Entry_Point_Path> (optional) - Selects the entry point of the process. It applies to .nupkg files and --package-id. It is ignored when --file points to a .xaml or .json file, and you can't use it with --process-name.

    示例:

    UiRobot.exe execute --file "C:\UiPath\Project\project.1.0.3.nupkg" --entry "OtherEntryPoint.xaml"
    UiRobot.exe execute --file "C:\UiPath\Project\project.1.0.3.nupkg" --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"
      
    • The --process argument of earlier versions still works as an alias of --package-id.

安装流程​

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

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

UiRobot.exe installprocess --process-name <process_name> [--folder <orchestrator_folder_path>]
UiRobot.exe installprocess --process-name <process_name> [--folder <orchestrator_folder_path>]
  • -p, --process-name <process_name> (mandatory) - The name of the process you want to install. The -p short form means process name here, but package ID in the execute command.

    示例:

    UiRobot.exe installprocess --process-name MyProcess
    UiRobot.exe installprocess --process-name MyProcess
    
  • --folder <orchestrator_folder_path> (optional) - The full path of the Orchestrator folder containing the process you want to install, such as Product/Development/QA. This argument applies only when the connection to Orchestrator is active. If only one folder contains the process for installation, skip this parameter.

    示例:

    UiRobot.exe installprocess --process-name MyProcess --folder "Product/Development/QA"
    UiRobot.exe installprocess --process-name MyProcess --folder "Product/Development/QA"
    

连接​

Use this command to connect your Robot to an Orchestrator instance. If your Robot is already connected to a different Orchestrator instance or with different credentials, the command returns the "Orchestrator already connected" message. Run disconnect first to switch. Running it again with the same URL and credentials succeeds and changes nothing.

连接命令使用以下参数:

UiRobot.exe connect --url <Orchestrator_Server_URL> --clientId <Client_ID> --clientSecret <Client_Secret>
UiRobot.exe connect --url <Orchestrator_Server_URL> --clientId <Client_ID> --clientSecret <Client_Secret>
  • connect - Establishes the connection to Orchestrator. Must be used together with the --url, --clientId, and --clientSecret arguments.

    示例:

    UiRobot.exe connect --url https://cloud.uipath.com/<Organization_Name>/<Tenant_Name>/orchestrator_ --clientId <Client_ID> --clientSecret <your-client-secret>
    UiRobot.exe connect --url https://cloud.uipath.com/<Organization_Name>/<Tenant_Name>/orchestrator_ --clientId <Client_ID> --clientSecret <your-client-secret>
    

    The command also accepts --url with --key <Machine_Key> for a machine key connection. Robots connected with a machine key don't run agents, functions, or API workflows by default, and the command prints a message that calls machine key connections deprecated. For the differences, refer to Connecting the Robot to Orchestrator.

断开连接​

使用此命令可断开机器人与当前 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
    

You can't use --force and --wait together. The disconnectandsignout command takes the same arguments, and also signs out the current user.

追踪​

Use this command to enable or disable low-level tracing of the UiPath drivers and the browser extension. Tracing of the Robot Executor and Service is always on, and the command prints a warning about it.

追踪命令使用以下参数:

UiRobot.exe trace --enableLowLevel | --disableLowLevel
UiRobot.exe trace --enableLowLevel | --disableLowLevel
  • --enableLowLevel - Starts low-level tracing of the UiPath drivers and the browser extension. Requires administrator rights.

    示例:

    UiRobot.exe trace --enableLowLevel
    UiRobot.exe trace --enableLowLevel
    
  • --disableLowLevel - Stops it and saves the trace as UiPathTrace-<id>.etl on the Desktop of the user who runs the command. Requires administrator rights. Without them, the command shows an error but still returns exit code 0.

    示例:

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

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

PiP 命令使用以下参数:

UiRobot.exe pip --enable | --disable
UiRobot.exe pip --enable | --disable
  • --enable - Enables the Robot session (PiP functionality) of the machine.

    示例:

    UiRobot.exe pip --enable
    UiRobot.exe pip --enable
    
  • --disable - Disables the Robot session (PiP functionality) of the machine.

    示例:

    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> (optional, default 30) - Deletes global-packages entries whose .nupkg.metadata file has not been accessed in the last X days. Stale or corrupt package folders (missing .nupkg.metadata) are removed regardless of this value, unless they are listed in nugetclean.ignore. The HTTP cache is wiped in full regardless of this value. Must be greater than 0.

    示例:

    UiRobot.exe cleannugetcache --period 60
    UiRobot.exe cleannugetcache --period 60
    
  • -t, --timeout <timeout_in_minutes> (optional, default 10) - Maximum time, in minutes, to wait for the cleanup. Press Ctrl+C to cancel the cleanup; the command then prints a partial summary.

    示例:

    UiRobot.exe cleannugetcache --timeout 20
    UiRobot.exe cleannugetcache --timeout 20
    
  • --allow-unsafe (optional, default false) - By default, the command refuses to run if the Robot packages folder (PackagesInstallationFolder in UiPath.config) differs from the default NuGet global-packages folder (a folder that may be shared with other users). Use this flag to force cleanup of the Robot packages folder.

    重要提示:

    Cleaning a shared packages folder may break running jobs or apps belonging to other users sharing the folder.

    示例:

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

此命令会打印清理摘要,并按 global-packages 和 http-cache 进行细分,包括从匹配总数中删除的条目数量。

To protect package folders from the cleanup, list them in a nugetclean.ignore file in the global-packages folder. Write one package folder per line, as an absolute path or a path relative to the global-packages folder. A line with only a package ID keeps every version of that package. Blank lines and lines that start with # are ignored.

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

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

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 <your-password>
    UiRobot.exe setproxy --username myuser --password <your-password>
    
  • --domain <domain>(可选)- 用于代理基本身份验证的域名。当代理需要符合域名条件的凭据时,使用此选项。

    示例:

    UiRobot.exe setproxy --username myuser --password <your-password> --domain MYDOMAIN
    UiRobot.exe setproxy --username myuser --password <your-password> --domain MYDOMAIN
    
重要提示:

运行命令会覆盖之前存储的任何代理凭据。

其他参数​

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

  • version - Displays information about the Robot version. The --version form also works.
  • --help - 显示受支持命令的列表,以及相应的信息和示例。
  • flushlogs [--timeout <timeout_in_seconds>] - Sends all pending logs to Orchestrator. The default timeout is 30 seconds.

退出代码​

UiRobot.exe returns the following exit codes:

退出代码意义
0The command succeeded. For execute, the job completed successfully.
1For execute, the job failed. For cleannugetcache, the cleanup didn't complete successfully.
2For execute, the job suspended. The command prints the resumeId of the suspended job.
-1The command was used incorrectly (invalid or missing arguments), or it failed with an error.

此页面有帮助吗?

连接

需要帮助? 支持(opens in new window)

想要了解详细内容? UiPath Academy(opens in new window)

有问题? UiPath 论坛(opens in new window)

保持更新