I am trying to pass in multiple variables as arguments for a Start Process activity in UiPath Studio and am struggling to understand how it should be configured or if its possible at all.
Any help would be greatly appreciated! Thanks in advance!
I am trying to pass in multiple variables as arguments for a Start Process activity in UiPath Studio and am struggling to understand how it should be configured or if its possible at all.
Any help would be greatly appreciated! Thanks in advance!
Hi,
Basically,we can write it as writing in command prompt (Just separate by whitespace.)
Can you share specific example, if possibile?
Regards,
I have two string type variables/arguments passed in from an orchestrator process that I am trying to use as arguments of the start process activity. One is named email and the other is named site.
I’ll check with our security department tomorrow to see if I’m able to share some screenshots.
HI,
If the variables don’t contains any special character such as whitespace or double quote etc, the following will work
$"{email} {site}"
Regards,
HI,
What version of Studio do you use? Which project compatibility do you use, Windows or Windows-Legacy?
If Windows-Legacy, the following will work.
String.Format("{0} {1}",email,site)
Regards,
I’m on studio version 2023.4.4 and am using Windows Legacy.
HI,
Windows-Legacy doesn’t support Interpolated Strings. So can you try to use String.Format method as the above post?
Regards,
Sounds good. I will try that!
Right now my hopes are to run a http request activity directly after the batch file runs. Do you know if its possible to check and see if there was an error in the batch file and then conditionally run the http request based on that?
Thanks for all your help and responses so far!
You should be using Invoke Powershell instead of Start Process with cmd. Then it’s easy to know what happened in the window and check the results.
Can you explain how I would check the results with that activity? Not sure I’m following.
The Invoke Power Shell activity has much more robust features than using Start Process.
If the batch file errors, I believe the Invoke Power Shell activity will throw an exception.
And you can use the Output argument to get the results of whatever command you run.
Note that the Output is a collection of whatever you have Type Argument set to. So if you have Type Argument set to Object then Output is a collection of objects. I generally use a Type Argument of String, and then you get back a collection of string. It’s a little odd, I don’t know why it doesn’t just give back a string. But you can use Join to put the collection of strings back into just a string if you want.
The Invoke Power Shell activity doesn’t seem to like basic batch file syntax? Not sure what’s going on with that.
You don’t put the text of the bat file into the CommandText field. You use cmd to execute the bat file.
You could, of course, store that command in a variable or use an expression in the Command Text property to build the command.
Alright, I got that working. I’m logging out the output of the Invoke Power Shell activity now but it seems to just log everything that’s in the batch file. I guess I’m still not understanding how to determine whether there’s an error in the batch file.
I’m using “EXIT /B 1” in my batch file and when I just ran it with that the Invoke Power Shell activity did not throw an exception.
Looks like you’d just have to do error handling in the bat file and make it output a consistent message (ie starting with “[Exception]”) so you can then detect that from the Invoke output.
Do you know how I can pass in arguments to the batch file with the Invoke Power Shell activity? I’ve tried using the parameters and powershell variables option in the properties panel with no luck.
In my batch file I’m using “echo test %1” to try to output the first argument.