diff --git a/templates/powershell.txt b/templates/powershell.txt index 86b1966..9d42dd5 100644 --- a/templates/powershell.txt +++ b/templates/powershell.txt @@ -27,6 +27,12 @@ function global:__zoxide_pwd { # cd + custom logic based on the value of _ZO_ECHO. function global:__zoxide_cd($dir, $literal) { + + if ($dir.StartsWith('%') -and $dir.EndsWith('%')) { + $envVar = $dir.Trim('%') + $dir = $env:$envVar + } + $dir = if ($literal) { Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop } else {