How to execute command line statement

powershell
studio

#1

I want to execute a command which is based on Jar file as below.

java -jar d:\tabula-1.0.1-jar-with-dependencies.jar -p all -g -l -o D:\bank.csv d:\bank.pdf

Above line is entire one statement if I run it as is in cmd prompt it runs fine. How do I run this via UiPath?

Thanks
Manoj


#2

Invoke PowerShell Activity

You’ll have to put it in double quotes and adjust it a little.


#3

Hey buddy,

I did put it in double quote as strong however I get command not found error. Not sure what needs to be done.

Thanks
Manoj


#4

Hi,

Try activating “IsScript”. The reason is that native PowerShell commands are slightly different from ordinary executables and can take strongly typed, named input arguments that you can supply in the Parameters dictionary. The actual command in this case is solely the command name, e.g. “Get-Process”. The script setting causes the command string to be run as-is, instead of being interpreted as mentioned.


#5

Hi sfranzen,

That worked. Thanks a lot.

Regards
Manoj


#6

Apologies, I wasn’t able to get to this yesterday. But yes, my suggestion would have been same as @sfranzen


#7

Sorry. :slight_smile: I had just solved my own confusion over this in a workflow and saw this topic. In fact I ended up combining several commands in a powershell script file and using the Powershell Script activity. It’s also possible to define parameters that your script will receive from the workflow, another neat trick I didn’t know about.


#8

Can anyone please provide sample workflow. I am facing “specified file not found error”, I am trying to open a word document through powershell using Ui path.


#9

Hi,

What did you try that does not work? As far as I know it should be sufficient to enter the document path (as a string) inside the Invoke Power Shell activity, e.g. "C:\Path\To\document.docx", and it will open with the default application for the file type.