How to call git bash command from powershell

In this tutorial, How to call git bash command from Powershell. For example git bash content to split CSV file on windows :

Call git bash command from powershell

K:/TEST/split.sh

cd $1
echo split start
date
pwd
split Filetest.CSV Filetest -l 20000000 -d
ls -l
for filename in $1/*; do
wc -l $filename
done
date
echo split end
exit

Powershell content:

$TOOL_PATH = "K:/TEST"
$FOLDER_PATHS = "K: / TEST / INPUT"

$COMMAND = "bash.exe" + " " + $TOOL_PATH + "/split.sh"
echo $COMMAND
Invoke-Expression $COMMAND

Add C:\Program Files\Git\bin into PATH environment

OK!

Thank you for reading the DevopsRoles page!

About Dang Nhu Hieu

I'm Vietnamese. In the past, I'm a software developer, now working in Japan on an Infra team. Skill : AWS, VMware, HA architech,setting Database : Oracle DB, PostgresDB ,.. Programming language : Java, C#, Python, Bash linux, Batch windows, powershell ,... Hobbies: badminton, film photo, travel. https://www.linkedin.com/in/hieu-dang-15a0561a6/
View all posts by Dang Nhu Hieu →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.