Start workflow from .bat file


#1

Hi there.

Is it possible to start a process using a bat file/windows scheduler with the attended robot?
I’ve tried to write a bat file and executing it with windows scheduler but it seems the process doesn’t start.

Thanks.


#2

Does your workflow starts when you run the batch file directly?

I have seen in some cases that where the robot doesn’t start if ‘Run with highest privileges’ checkbox while creating the task is not checked.

Note: I believe UiPath doesn’t officially support task scheduler however its still seem to be working.

Thanks,
Rammohan B.


#3

the workflow doesn’t start when running the bat file directly.

the content of my file is: start “” /min “C:\Program Files (x86)\UiPath\Studio\UiRobot.exe” /file:"%~dp0Main.xaml" /input:"{‘StartedByTaskScheduler’:true}"

I’m not really that experienced in .bat files, so i have no idea if it has errors.

Thanks.


#4

Since your .bat file has relative path of the xaml, i hope you have it inside your project itself. Let me know if thats not the case. In that you may try giving the full path of your main.xaml file.

Thanks,
Rammohan B.


#5

Just tried with this in the .bat file:

start “” /min “C:Program Files (x86)\UiPath\Studio\UiRobot.exe” /file:“C:\Users\Admin\Documents\UiPath\Sendinger\Main.xaml” /input:"{‘StartedByTaskScheduler’ :true}"

It looks like cmd is activated and then closed immediatly when i run the file. But i won’t start the workflow.

The content in my folder is:
Main.xaml
project.json
Run.bat

I can’t find any sense in why it’s not working. The workflow works fine when i execute it in studio.


#6

I hope its just a typo here, just in case you are missing it in the batch file as well. ‘\’ before ‘Program…’ in the robot path is missing.

If that’s not the case, then it looks like the UiRobot is not getting started. Check in your process if there already a running UiRobot Process. If yes then kill it and retry to start the batch file. If not then check if you can double click on run ‘UiRobot.exe’ from that path and able to start the UiRobot or not.

This exact syntax for the batch file works perfectly fine for me. I don’t see any other issue here.

Thanks,
Rammohan B.


#7

Oops just a typo. :slight_smile:

Just tried to stop ui robot, but still no luck with the bat file. I can start the robot manually and start the workflow from here but it doesn’t seem to execute the workflow when using the bat file still…
It’s really weird.

If you have any other solutions please let me know.


#8

Just tried to paste the content of the .bat file directly into cmd. This started the process. So i guess the file gets blocked from starting cmd. Kan this be a firewall issue?


#9

Can you try running the batch file as administrator by right click and selecting ‘Run as Administrator’?

Thanks,
Rammohan B.


#10

Just tried. Same result. :confused:


#11

Can you add a keyword ‘pause’ as the last line of the batch file and run it again. It will stop at the command prompt so that you get a chance just to cross verify your commands again.

Thanks,
Rammohan B.


#12

This is what i get:

C:\Users\Philip Marlow\Documents\UiPath\Sendinger>´╗┐start “” /min “C:\Program Files (x86)\UiPath\Studio\UiRobot.exe” /file:“C:\Users\Philip Marlow\Documents\UiPath\Sendinger\Main.xaml” /input:"{‘StartedByTaskScheduler’:true}"
‘´╗┐start’ is not recognized as an internal or external command,
operable program or batch file.

Keyboard issue?


#13

Fixed it.

I downloaded Notepad++ and chose UTF-8 under Encoding menu.
Saved the file as .bat
And it works.

I think my normal notepad uses BOM or something like that, which command prompt doesn’t support.

Thank you @Rammohan91 for your help and patience :slight_smile:


#14

Finally… Great… :smile:

Thanks,
Rammohan B.