UIRobot not calling From Batch Job when Batch job calling from .net application

Hi All,
I am trying to calling the batch job from .net application. Batch job contains one cmd command which is calling UIpath workflow. when i run batch job manually it’s working fine. but it’s not starting from .net application
Below my Batch Job command ,

start “” /min “C:\Program Files (x86)\UiPath\Studio\UiRobot.exe” /file:“D:\RPA\SampleProjectRobot\GenerateExceptionalTimesheetReportProcess\Main.xaml”

–.net Code

Process proc = null;

            string batDir = string.Format(@"C:\botfile");
            proc = new Process();

            proc.StartInfo.WorkingDirectory = batDir;
            logger.Trace("process" + proc.StartInfo.WorkingDirectory);
            proc.StartInfo.FileName = "RobotJob1.bat";
            logger.Trace("filename" + proc.StartInfo.FileName);
            proc.StartInfo.CreateNoWindow = false;
            logger.Trace("Process Start...");

            logger.Trace("After Executing the Batch Job");

Hi @amol2,
Can you share screen of your workflow with properties from activity where you using this code?

Thanks for your reply,

Below code i am using in .net application from that i am calling batch job and batch job calling the RPA process on button click. But uirobot itself not starting.

I see. Please check this (Section "Automation Projects when Not Connected to Orchestrator):

I’m not sure if it can work the way you do it. Actually it is working when you using command manually, but then robot is using your account to open robot and run the project. Running it from .net application makes it run as a “system” thread not user.

I am not using Orchestraor.

That’s why I marked that you should check section about automation when NOT connected to Orchestrator.

Bu how it is UIPath robot call when double click on batch file.only i am facing problem when calling from .net application only. when i double click and scheduled the task then it’s working fine. i already have json file in folder.

I understand you completely. What I mean is when you are running batch file manually or even from task scheduler the whole application and workflow is running in “user context”. Running it from .net (from code) it will be treated in “system context” and this probably makes it not working.

Please maybe check this case from StackOverflow:

yes…thats my problem …i will try to figure out in stack overflow…thanx:)

1 Like