Powershell:在 PowerShell 中重新加载路径 [英] Powershell: Reload the path in PowerShell

查看:31
本文介绍了Powershell:在 PowerShell 中重新加载路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个 PowerShell ISE 实例正在运行并且我安装了一些修改 PATH 的东西,或者我在 PowerShell 之外以任何方式修改了它,那么我需要重新启动 PowerShell 以查看更新的 PATH 变量.

If I have an instance of PowerShell ISE running and I install something that modifies the PATH or I modify it in any way outside of PowerShell then I need to restart PowerShell for it to see the updated PATH variable.

有没有办法从 PowerShell 中重新加载路径而不重新启动它?

Is there a way to reload the path from within PowerShell without restarting it?

推荐答案

只为带来Rob 的评论点亮:

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") 

这篇关于Powershell:在 PowerShell 中重新加载路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆