3

I have below PowerShell script in my Yaml pipeline, where I am trying to add Path in environmental variable Path, I am not getting any error but my test cases is failing which is dependent on one of the path variable I am setting below.

Is there a way if I can debug and see what all path has been added to my path variable below. If yes how can I see it?? as my test cases pass locally when setting the path env variable.

- powershell: |
      Set-Variable -Name PATH -Value "$env:PATH;$(IppRoot)\redist\intel64_win\ipp;$(Build.SourcesDirectory)\Project_x64-$(osSuffix)\bin;$(Build.BinariesDirectory);$(LibFT4222Root)/imports/LibFT4222/dll/amd64"
      Write-Host "##vso[task.setvariable variable=PATH]$PATH"
      displayName:  'Add binaries to PATH on Win'
      condition:    eq(variables['Agent.OS'], 'Windows_NT')
Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
ZZZSharePoint
  • 1,163
  • 1
  • 19
  • 54

1 Answers1

2

You can add another step after it and just print all the environment variables:

- task: CmdLine@2
  inputs:
    script: 'set'

Now you can check if it's indeed added to the Path in the previous task.

By the way, to add a new value to the PATH you can use a special logging command:

Write-Host ##vso[task.prependpath]c:\my\directory\path
Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
  • the first step you mentioned, how I am checking if it is added to the Path. you have just added script "set" in the path. will set print me all the env variables in the Path? – ZZZSharePoint Mar 22 '21 at 07:25
  • 1
    It will print the PATH with all the values inside. anyway, you can `echo %PATH%`. – Shayki Abramczyk Mar 22 '21 at 07:42