0
votes

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"
1
Try dropping 1st / in path.F. Hauri
Actually that is parameter I receive from another yaml. Edited the path I receive.user15338350

1 Answers

0
votes

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.

enter image description here