Hi @alexander.cleak,
I tried this today and the robot can be triggered from a .net program as described below. The main requirement with this approach is that the full path to both the UiRobot.exe and the Process.xaml file need to be mentioned in the .bat file.
Approach:
- Make a simple
.batfile with the following contents
Echo "Starting the UiRobot.exe and executing a UiPath .xaml example file."
"C:\Users\%username%\AppData\Local\UiPath\app-20.10.2\UiRobot.exe" execute --file "C:\Users\%username%\Documents\UiPath\ForumAnswers\IEnumerableUiElement.xaml"
Echo Execution Ended"
-
Make a .net Console App (Project) in Visual studio

-
Create a
program.csfile with the following contents.
This invokes theCMD.exeto run the.batfile from Step 1.
using System;
namespace ExecuteUiPathRobot
{
class Program
{
static void Main(string[] args)
{
// This thread was really helpful https://stackoverflow.com/questions/1469764/run-command-prompt-commands
// Step 1: First we make a bat file which contains the command
// “FullPathToYourUIROBOTEXE\UiRobot.exe” execute --file “FullPathToYourProcessXAMLfile\Main.xaml”
// Step 2: We use /K to ensure that we can see CMD execution window
string userName = Environment.UserName;
string batfilepath = "/K C:/Users/"+userName+"/Downloads/executeUiPathRobot.bat";
// Step 3: We invoke the batfile contents using Process.Start method
try
{
System.Diagnostics.Process.Start("CMD.exe", batfilepath);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
- You can further integrate this into your C# code as per your use case with better exception handling offcourse
Trying to solve this was fun. Thanks!