Calling .sh file from UiPath

How to call a .sh file from UiPath??


You probably need to do it from within a Powershell script. Have a search online plenty of articles.

You can use Invoke Powershell Script from within UiPath.

1 Like

Hi Anjali
As @richarddenton rightly mentioned already, you can employ PowerShell to run a bash shell script.

  1. Running the bash on windows machine : You can install cigwin or you can define the Path variable for a bash application in windows and run the script from a shell prompt or if you are using windows 10 then you can utilize the native bash shell feature of it which can directly run bash scripts on windows.

Feel free to revert for any clarifications.




I am still not clear, please check the below screenshot to get more details on what exactly I am looking for

Now, kindly suggest how I can resolve this?


Hi @anjalimishra

Thank you for the details.

Here, you are trying to create a 0 kb file using touch command which is a shell based command(UNIX) hence it will not work on windows platform.

I assume that you are trying to create a new file in the ~ directory in a windows system(if linux, please specify the same) and for that you can use PowerShell.

Please refer the below mentioned command to create a new file in windows

> New-Item c:\user1\AnEmptyFile.txt -ItemType file

Mention the same command in the Invoke Powershell activity and do change the path of the file as per your requirement.

Feel free to revert for any further clarifications.



1 Like

The command which you have given is running fine, but I need to run a shell command.
Can you please suggest how can I do the same?


Have tried using “Start Process” with the .sh file in the arguments? I know you can run other scripts like batch and vbscripts with that method.

You could probably use Powershell too. Just look up the syntax and create a .ps1 file to call that runs your .sh file.

1 Like

Hi Rajat,
I am having issues getting UiPath to run Win10 native bash commands.Screenshots show bash works from the command line, works invoked from an AutoHotkey script, but fails from a UiPath workflow. Any help you can give me getting going with it would be great.

  1. PowerShell, as you, Richard and Clayton point out, l is an option that works for some things, and I use it when needed, and it works fine.
  2. Git bash also works with UiPath workflows with no issues encountered yet.
  3. Here’s the rub: Any workflow that calls “C:\Windows\System32\bash.exe” will not run. Calling PowerShell to run native bash will not run from a workflow, although it works fine with the command line.

I’m afraid I should have logged more of my results, but on several occasions PowerShell (invoked from a workflow) asked for a Windows Credential. Stepping through workflows, the Output window has on some occasion shown that bash is not recognized as a command. This leads me to believe I may have to give UiPath permission to access bash, but I have not found anything in the forum or StackOverflow yet to suggest how to do it.

I believe that any workflow that would simply execute “bash -c ls” would get me most of the way there, be it from “Start Process”, “Run Power Shell Script”, or anything.

The Microsoft docs on security policies and local Win10 accounts are sufficiently opaque to me that I’ve not been able to determine whether I need to set a security policy for UiPath to use bash or not.

Here’s some screenshots:

Okay, bash works …

AHK calling WLS bash

Calling a bash script from an AutoHotkey script works …

WLS bash output

But UiPath can’t, apparently, access it as I have it configured.

Once again, thanks for your help. Also, Richard, Clayton, any thoughts?


Have you checked if bash.exe is located in the System32 folder? Maybe it’s in a different folder? I would look for the physical .exe file you want to call, then use the fullpath. If you can’t find it, then I’m not sure.

1 Like

Thanks, Clayton, it’s where it’s supposed to be (System32). Calling the fullpath doesn’t work from UiPath either …
My suspicion (from the screen shot saying the command isn’t recognized) is still that UiPath on my system doesn’t have access to bash (it obviously has access to System32). If I can figure out if this link can help maybe I can get there. I’m pretty new to Win10, and so far I haven’t been able to get “full control” for bash security policy applied to Administrator, even though I changed the owner from “Trusted Installer” to “Administrator”. Still trying :grinning:. At least it’s a worthwhile exercise.


What if you create a powershell (.ps1) file and call that which calls the commandline?
invoke-expression “cmd bash -c ls”
invoke-expression “cmd ‘c:\windows\system32\bash.exe’ -c ls”

Then call the Powershell.

1 Like

Thanks, Clayton, no joy so far.
The script “script6.ps1” is:

invoke-expression "bash -c ls"

See screenshots.

So far so good. But …

From UiPath, running my workflow that executes this:
Not only does UiPath not see bash, it doesn’t recognize the Set-ExecutionPolicy I have in place. So something is out of kilter for security policies for UiPath, I think. I’ll keep trying, and thanks!

Edit: Here’s what my UiPath program had to say when I passed “powershell Get-ExecutionPolicy -list”:

From the prompt:
Actual policy


I see you did invoke-expression "bash -c ls”. Did you try it with cmd? like invoke-expression "cmd bash -c ls”

Oh well. I wish I was an expert on this stuff!


1 Like

Thanks, Clayton, invoke-expression “cmd /c bash -c ls” also works from the PS prompt, but fails in UiPath.


I think I’m beating a dead horse here.

UiStudio is 32-bit. C:\Windows\System32\bash.exe is 64-bit and does NOT have a corresponding executable in SysWOW64.

I guess it’s Cygwin or Git bash for now - I haven’t tried Cygwin lately but Git bash works fine.
Here’s a shot from the file selection dialog from the Start Process activity:

no bash

No bash :frowning:

From File Explorer:

Yes bash :slight_smile:


But the dead horse whimpers:

Dead horse whimpers


  1. a 64-bit AHK executable (UiPath will start this just fine).
  2. patience
  3. shell scripts instead of “bash -c ”, i.e. “bash ./”

Workflows, executable, test.csv and sample scripts included in zip file. (1.9 MB)

Best of luck, all feedback appreciated.