I want to retrieve path to the branch and folder inside it, basically i wan to read the jsons here and change the dev keyword with uat and save the file back to the sam folder in workspace_publish branch. I can change dev to uat, but am not able to correctly use the path to the files. I am doing this in powershell task in release pipeline.
I have tried using this path :
$(System.DefaultWorkingDirectory)_Data Stage V9_u\foldername\TemplateForWorkspace.json
But i am getting path error with this.
i have tried changig slashes / \ too but the error persists.
024-05-15T07:05:41.1203526Z ##[section]Starting: PowerShell Script
2024-05-15T07:05:41.1616420Z ==============================================================================
2024-05-15T07:05:41.1616789Z Task : PowerShell
2024-05-15T07:05:41.1616958Z Description : Run a PowerShell script on Linux, macOS, or Windows
2024-05-15T07:05:41.1617027Z Version : 2.237.5
2024-05-15T07:05:41.1617162Z Author : Microsoft Corporation
2024-05-15T07:05:41.1617303Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2024-05-15T07:05:41.1617380Z ==============================================================================
2024-05-15T07:05:42.6804168Z Generating script.
2024-05-15T07:05:42.7117125Z ========================== Starting Command Output ===========================
2024-05-15T07:05:42.7368835Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\agent\_work\_temp\bc7b551c-5267-4e4c-9e52-e2a0683185c5.ps1'"
2024-05-15T07:05:43.1695349Z At C:\agent\_work\_temp\bc7b551c-5267-4e4c-9e52-e2a0683185c5.ps1:6 char:48
2024-05-15T07:05:43.1696665Z + $inputPath = $(System_DefaultWorkingDirectory)/_Data Lake V1_u/synw-i ...
2024-05-15T07:05:43.1697533Z + ~
2024-05-15T07:05:43.1698046Z You must provide a value expression following the '/' operator.
2024-05-15T07:05:43.1698617Z At C:\agent\_work\_temp\bc7b551c-5267-4e4c-9e52-e2a0683185c5.ps1:6 char:48
2024-05-15T07:05:43.1698943Z + $inputPath = $(System_DefaultWorkingDirectory)/_Data Lake V1_u/synw-i ...
2024-05-15T07:05:43.1699371Z + ~~~~~
2024-05-15T07:05:43.1699808Z Unexpected token '_Data' in expression or statement.
2024-05-15T07:05:43.1700391Z At C:\agent\_work\_temp\bc7b551c-5267-4e4c-9e52-e2a0683185c5.ps1:8 char:49
2024-05-15T07:05:43.1700678Z + $outputPath = $(System_DefaultWorkingDirectory)/_Data Lake V1_u/synw- ...
2024-05-15T07:05:43.1701093Z + ~
2024-05-15T07:05:43.1701527Z You must provide a value expression following the '/' operator.
2024-05-15T07:05:43.1702120Z At C:\agent\_work\_temp\bc7b551c-5267-4e4c-9e52-e2a0683185c5.ps1:8 char:49
2024-05-15T07:05:43.1702404Z + $outputPath = $(System_DefaultWorkingDirectory)/_Data Lake V1_u/synw- ...
2024-05-15T07:05:43.1702797Z + ~~~~~
2024-05-15T07:05:43.1703199Z Unexpected token '_Data' in expression or statement.
2024-05-15T07:05:43.1703584Z + CategoryInfo : ParserError: (:) [], ParseException
2024-05-15T07:05:43.1704538Z + FullyQualifiedErrorId : ExpectedValueExpression
2024-05-15T07:05:43.1704685Z
2024-05-15T07:05:43.3041139Z ##[error]PowerShell exited with code '1'.
2024-05-15T07:05:43.4458601Z ##[section]Finishing: PowerShell Script