带 UiPath 的 Powershell

Powershell with UiPath

我正在使用 UiPath 启动 PowerShell 脚本。我需要从 UiPath 传递一个参数。首先这是可能的,其次有人有这方面的例子吗?不确定 PowerShell 脚本中的语法是什么

是否可以将参数从 UiPath 传递到终端。

  • 您的 PowerShell 脚本需要保存在一个 txt 文件中 文件.(PSSampleParameters.txt)

代码示例(PSSampleParameters.txt):

Param(
  [string]$computerName
)

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") 
[System.Windows.Forms.MessageBox]::Show($computerName) 
  • 添加 "Read Text file" activity 并在文件名上添加您的 PowerShell 脚本。

  • 添加 "Invoke Power Shell" activity 并确保将 "ContinueOnError" 设置为 True 并检查 "IsScript"

  • 选择 "Invoke power shell" activity 转到右侧面板并单击“参数”中的“...”按钮。在将打开的屏幕中,您可以添加参数。