How to copy text from command prompt onto "log.txt"?

Hi I am new to UiPath Studio can someone please help me with this? I have tried many ways like get text, find element, etc… not sure if i did it wrongly but it does not work. I need to copy all the text from command prompt and then paste it onto a text file named “log.txt” I also cannot use Ctrl + A & Ctrl + C not sure why but it did not work on my command prompt please help me…


you can use invoke powershell script activity in which you can run the commands you need and that would invoke and get the output as well into variable

from there yu can access i and write as you need

you need not use ui at all


1 Like

Hey @Kelly12345

Sequence :

1 : extract the text By using the get text Activity (Create variable :OutputVariable)
2 : use write text activity give the file name : “C:\path\to\log.txt”
3 :Text: OutputVariable

Cheers: :upside_down_face:


Sample logic here.

Main.xaml (8.7 KB)


Ashok :slight_smile:

1 Like

hello i have tried this multiple times but i can’t seem to get it to paste the text into log.txt it is always blank

Did you put the variable into the output property of Invoke Powershell?

1 Like

This is what I did please let me know how should I change/improve it because I can’t copy the text from command prompt and I need to do it(get the text) on command prompt I can’t do this on other apps.

You’re supposed to be using Invoke Powershell, not UI automation on cmd.exe

1 Like


Tried this? I made whole POC for it.

1 Like

hi, I need to show that I opened the command prompt and type in ipconfig and then proceeds to copy the text in it then save it inside log.txt

yes I have tried this but I need to open command prompt and show that I have typed in ipconfig and then proceeds to copy the text and then saving it inside log.txt

Is it attended automation you are working on?

In a way I think yes? This is just a simple assignment that I would need to demonstrate from the following instructions that I posted which is to open the application first which is the command prompt and then type in “ipconfig” and then I will need to enter and get the ip address and everything like what the screenshot showed then I will need to copy whatever is shown on the command prompt into “log.txt”


Not sure about your experience in the field but would like to share you a note: whenever we automate any use case we first optimize or eliminate Non Value Added (NVA) steps. This ensures performance and best return on Investment (ROI)

One more thing, don’t try to follow as is process (Manual process). Follow To Be Process (How bot will take the input and generate the desired output. How it does, should not concern of the business :smiley: )

I still feel the step to open CMD prompt is NVA but it’s your use case.

Good luck :v:

Ashok :slight_smile:

I am very inexperience:,) but thanks for trying to help


This is not a UI related task at all as already mentioend…invoke power shell is what you need to use

Or one thign you can do is…run the commands then take a screenshot to show they are run


can write that data in excel