DEV Community

taijidude
taijidude

Posted on • Updated on

Execute a powershell script from inside the git bash

I develop on Windows. And somehow got into the habit of using both the powershell and the git bash. It's not clear cut, but generally speaking i use git bash for small tasks and moving around the file system. When writing longer scripts i tend to use powershell.
This week i stumbled about a nice way to execute a powershell script from the bash. This helps to reduce context switches.

You have to use the following Statement

$ powershell -File scriptToRun.ps1
Enter fullscreen mode Exit fullscreen mode

When you use an alias it gets even more convinient

$ alias ps='powershell -File'
$ ps scriptToRun.ps1
Enter fullscreen mode Exit fullscreen mode

Discussion (0)