Start Process: how to get returning value


I’m using the “Start Process” activity (from UiPath.Core.Activities.StartProcess) as a workaround for running PowerShell commands and scripts that don’t work properly for me after converting my process to Windows-Legacy to plain Windows. This is working somehow ok for those that merely execute an action, but there are others that produce a return value I have to pick up later and pass it to the following activities in my workflow on my project, but the “Start Process” activity doesn’t provide any way to collect any output of the process in any form of variable.

Any suggestion? In advance, I’d really want to avoid having to write any files to disk or so, if possible.

Thanks in advance

Hi @pere ,

Could you let us know what is the Output type generated ? Is it a String or Text value ?


How about using StandardOutput as the following post?


Yeah @supermanPunch ; that is. It’s a string/text with some sort of code.

In the original form it’s returned via a Power Shell variable; but I have no problem converting it to a standard output text message or whatever.

@pere ,

Would it be also possible to set the value to Clipboard and retrieve it later in the workflow using Clipboard actvities ?

I think this is overcomplicating things quita a bit.

Originally, this was an Invoke Power Shell action.

Later, I had to use the Start Process. Every call needs extra formatting for argumants and parameter, and somatimes encapsulating everything in a .ps1 script.

Now this adds an extra layer of complication. I’d like to avoid it if possible, @Yoichi .

I just want to catch one output line from the process call…

Hi @supermanPunch ,

I did a little test with your approach and yeah, it effectively copies the output to clipboard - but I don’t know what to further do with it. As an example

PS > .\myScript.ps1 "myParameter" | Set-Clipboard

Then I try a CTRL+V and it says there’s a value in the clipboard to be pasted. But how can I take that back to UiPath?

Thanks again

@pere ,

There is Get From Clipboard activity which should retrieve the value copied to Clipboard.

1 Like

Oh, thank you! I’m gonna try it right now.
It’s a bit of overhead and for sure not the most elegant way, but at least, if it works, it’s ok as a workaround…

Thanks again, @supermanPunch !! :smiley:

Oh, @supermanPunch , sorry to say that my first attempts of trying to use the Get From Clipboard were unsucessful…

I tried it two ways:

  • The first one, passing the powershell.exe executable as the FileName, then the “-file {blah.ps1}” as argument, didn’t catch anything from the clipboard and the output variable not only doesn’t have the expected value, but has the value of the name of the variable as a string! How can that be?

  • The second method of calling the script (I mean in the prior Start Process activity) is similar but in the arguments textinput I simple put the path to the .ps1 script and after that the parameters and the “| Set-Clipboard” pipelining part. Then the “Get From Clipboard” takes ages, sounds to me like an infinite loop, and after a while it outputs this:

@pere ,

I did check today with a simple script - Assigning a variable value to Clipboard and then checked with Paste operation on Notepad. It did work.

Could you maybe check with the below workflow : (2.6 KB)

Do check if a similar method could be adopted for your case


Yeah, in further attemps I got it to run; probably I did something wrong on this one.

Anyway, I cannot go this way to specifically solve the problem I’m encountering in - as the “Start Process” doesn’t preserve session info accross different “Start Process” calls for different PowerShell script calls - defeating the purpose of using it.

As I was already using this Start Process as a workaround for the defective Invoke Power Shell activity in Windows non-legacy projects, as per the staff suggestion, and it doesn’t work in my scenario, I’m really stuck - and the staff is not replying anymore. Oh my god.