I’m trying to write a very simple find/replace script in PowerShell but it needs to utilize some $OctopusParameters. Whenever there is not a space at the end of the parameter it doesnt’ appear to be resolved
Write-Output "- > Path: " $OctopusParameters['Octopus.Action[Deploy MyApp Admin].Package.CustomInstallationDirectory']
(Get-Content $OctopusParameters['Octopus.Action[Deploy MyApp Admin].Package.CustomInstallationDirectory']\wwwroot\app\js\app.js) |
Foreach-Object {$_ -replace "MyApp .local", "beta.MyApp.com"} |
Set-Content $OctopusParameters['Octopus.Action[Deploy MyApp Admin].Package.CustomInstallationDirectory']\wwwroot\app\js\app.js
The problem is in the Write-Output
the $OctopusParameters is inserted correctly
In the Get-Content
the $OctopusParameters is inserted as a literal instead of evaluated because it has a \ at the end.
What I’m trying to do is build a path with the Octopus parameter being the first part.
Any suggestions would be apprechiated!