Powershell、cmd不重启刷新环境变量

2023-08-02

安装chocolatey

参考 https://chocolatey.org/install

cmd

直接运行refreshenv即可刷新

powershell

新建或修改文件(xxxx为你的用户名)C:\Users\xxxx\Documents\WindowsPowerShell\profile.ps1,添加以下命令:

Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1

重启powershell后,运行refreshenv即可