Using an environment variable inside of a project variable

I have a variable defined in my project’s variables:

7zip = ${env:PROGRAMFILES}\7-Zip\7z.exe

How can I correctly resolve this from a powershell step?

Hi,

${env:PROGRAMFILES} has no meaning within Octopus, so we don’t try to resolve it - it will be passed to PowerShell as a raw string; I can’t think of any way to have PowerShell then evaluate this string apart from Invoke-Expression but that may have unintended side effects.

$foo = ("$" + "{env:PROGRAMFILES}\bar\baz")
$foo = iex ("Write-Output " + $foo)
$foo

Paul