Change current working directory in Azure Pipelines Change current working directory in Azure Pipelines azure azure

Change current working directory in Azure Pipelines


It took many hours to find the solution, but, apparently, there is a way to specify working directory for specific script -https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/command-line?view=vsts&tabs=yaml :

- script: # script path or inline  workingDirectory: #  displayName: #  failOnStderr: #  env:  # mapping of environment variables to add


Simple Solution to know the directory location in Azure devops :-

- task: CmdLine@2  inputs:    script: |      echo  '$(System.DefaultWorkingDirectory)'      dir      dir subfoldername

where you need to invoke the command line and get the current path by using System.DefaultWorkingDirectory and dir will list you all the folders and filesand using dir subfoldername we can traverse into subfolders