Reputation: 293
I was getting below error on using a self hosted windows agent.
##[error]Unable to locate executable file: 'bash'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
Here is my pipeline - Goal of task was to get the filename
alone from the whole filePath
and to use this filename
in further tasks.
trigger:
- master
parameters:
project: './test/abc/UnitTest.proj'
pool: self-hosted-windows
steps:
- task: Bash@3
inputs:
targetType: 'inline'
script: |
input="${Parameters.project}"
file_name_with_ext="${input##*/}"
file_only="${file_name%.*}"
echo "File : $file_only"
Upvotes: 3
Views: 7816
Reputation: 27
As mentioned in the above solution we need to add the path of the bash in the windows machine in which agent is running.
In my case the Windows machine that is running agent, there is no git bash so
You can also try running the command inline ,
Upvotes: 0
Reputation: 31075
The issue is you didn't add bash
command folder in the PATH of environment variable on the agent machine.
You need to login the agent machine, and then add "C:\Program Files\Git\bin" to the Path of Environment Variables, then restart the agent service.
Upvotes: 10