chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.05k stars 890 forks source link

Make refreshenv work out of the box in powershell without asking to import a module first #3362

Closed fricpa closed 7 months ago

fricpa commented 7 months ago

Checklist

Is Your Feature Request Related To A Problem? Please describe.

PS C:\Windows\system32> refreshenv
RefreshEnv.cmd does not work when run from this process. If you're in PowerShell, please 'Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1' and try again.

Describe The Solution. Why is it needed?

refreshenv just works in powershell, executing all steps necessary

Additional Context

There is no reason to tell me to load a module, just do it for me.

Related Issues

No response

pauby commented 7 months ago

This is the expected behaviour for PowerShell modules and so it's not something we'll be looking to add to Chocolatey CLI.

You need to add this to your PowerShell profile. Chocolatey CLI will do that, on installation, if your PowerShell profile exists. If it doesn't, then it can't add it.