31-05-24 10:49 AM
Hi,
I am trying to automate to run a schedule from command prompt using Utility-Environment VBO: Start Process The command prompt runs but the argument doesn't run, however I tried using the "Start process Read Stderr" Action but the stage keeps waiting while run and gets hanged.
Is there any solution other than automating CMD using attach.
I wanted the Start Process Action to work.
Thanks,
Answered! Go to Answer.
03-06-24 10:16 AM
Hi @Nandita_r ,
You can run the action in the following way as you can see I was able to also start a schedule at my end:
For setting up the workflow, I have three data items: Username (Text), Password (Password) and Schedule Name (Text). Use the 'Start Process Read Stderr and Stdout' action of the 'Utility - Environment' business object as shown below:
Process Name:
"""C:\Program Files\Blue Prism Limited\Blue Prism Automate\AutomateC.exe"""
Schedule Name:
"/user " & """" & [Username] & """" & " " & """" & [Password] & """" & " /startschedule /schedule " & """" & [Schedule Name] & """"
Also, on a side note, even if you have multiple schedules to run, you can write all the scheduler command one after another in one batch script and start the schedule as this will not immediately run the process anyhow but will just set the schedules to run at their designated time frames so it can be used for running multiple schedules for a given day.
31-05-24 05:34 PM
Can you let us know what you have in the [Schedule Argument] data item. Are you using the "/c" CMD.exe option?
02-06-24 03:30 PM - edited 02-06-24 03:32 PM
Hi @Nandita_r ,
A bit confused to why you want to open CMD.exe file as this action by default uses System.Diagnostics.Process class which is equivalent to the CMD shell itself. What I mean by this is that you directly can use CMD commands using this action as shown below:
For example, I want to get the hostname for my machine. How I manually would do the same using CMD screen is shown here:
Now if I want to do the same using Blue Prism, I would use the 'Start Process Read Stderr and Stdout' action of the 'Utility - Environment' business object as shown below:
You can see that upon executing the workflow, I am getting my desired output in the Standard Output data item:
Now, potentially if you have multiple commands to be executed one after another you can use this action multiple times in the same way that I showed you but they will work in separate sessions which means that if you have a scenario where let say within the same session you have multiple commands to execute then reusing this action again and again won't work. Also, for any commands using generic system keywords like cd, dir etc., the action cannot be used directly. For these cases, my suggestion would be to create a batch script and run the same using this action.
For example, if I have something like below to be executed:
For executing these commands, I will create a Batch script file as shown below:
Now, I can simply run the batch script using the 'Start Process Read Stderr and Stdout' action of the 'Utility - Environment' business object:
This would be the optimal way to use any CMD based batch script automation workflow in my opinion other than relying on any business object for spying the CMD GUI interface.
03-06-24 09:19 AM
I wanted to run this cmd
"C:\Program Files\Blue Prism Limited\Blue Prism Automate\"AutomateC /startschedule /schedule "schedulename" /user "user" "pwd"
03-06-24 09:59 AM
Hi @devneetmohanty07 ,
Thanks for the reply but I wanted to run this command: "C:\Program Files\Blue Prism Limited\Blue Prism Automate\"AutomateC /startschedule /schedule "schedulename" /user "user" "pwd"
To start schedules from command prompt, To use batch script I have multiple schedules to run, which cannot be added in one script.
Do use have any other solution where I Can execute this command.
03-06-24 10:16 AM
Hi @Nandita_r ,
You can run the action in the following way as you can see I was able to also start a schedule at my end:
For setting up the workflow, I have three data items: Username (Text), Password (Password) and Schedule Name (Text). Use the 'Start Process Read Stderr and Stdout' action of the 'Utility - Environment' business object as shown below:
Process Name:
"""C:\Program Files\Blue Prism Limited\Blue Prism Automate\AutomateC.exe"""
Schedule Name:
"/user " & """" & [Username] & """" & " " & """" & [Password] & """" & " /startschedule /schedule " & """" & [Schedule Name] & """"
Also, on a side note, even if you have multiple schedules to run, you can write all the scheduler command one after another in one batch script and start the schedule as this will not immediately run the process anyhow but will just set the schedules to run at their designated time frames so it can be used for running multiple schedules for a given day.
03-06-24 10:53 AM
Thank you so much @devneetmohanty07
It worked.