diff --git a/README.md b/README.md index c19edced..7abfd014 100644 --- a/README.md +++ b/README.md @@ -279,7 +279,8 @@ See [Advanced configuration](#advanced-configuration) for details and more confi ~~~ pwsh echo '$Env:PYENV_ROOT="$Env:HOME/.pyenv"' >> $profile.CurrentUserAllHosts - echo '$Env:PATH="$Env:PYENV_ROOT/bin:$Env:PATH"' >> $profile.CurrentUserAllHosts + echo 'if (Test-Path -LP "$Env:PYENV_ROOT/bin" -PathType Container) { + $Env:PATH="$Env:PYENV_ROOT/bin:$Env:PATH" }' >> $profile.CurrentUserAllHosts echo 'iex ((pyenv init -) -join "`n")' >> $profile.CurrentUserAllHosts ~~~ diff --git a/libexec/pyenv-init b/libexec/pyenv-init index b5c9aa61..a9f30c1b 100755 --- a/libexec/pyenv-init +++ b/libexec/pyenv-init @@ -160,7 +160,8 @@ function help_() { echo "# the following to $profile :" echo echo '$Env:PYENV_ROOT="$Env:HOME/.pyenv"' - echo '$Env:PATH="$Env:PYENV_ROOT/bin:$Env:PATH"' + echo 'if (Test-Path -LP "$Env:PYENV_ROOT/bin" -PathType Container) {' + echo ' $Env:PATH="$Env:PYENV_ROOT/bin:$Env:PATH" }' echo 'iex ((pyenv init -) -join "`n")' ;; * )