windows - 设置 Windows PowerShell 环境变量

标签 windows powershell

我发现设置 PATH 环境变量只会影响旧的命令提示符。 PowerShell 似乎有不同的环境设置。如何更改 PowerShell (v1) 的环境变量?

注意:

我想让我的更改永久生效,这样我就不必在每次运行 PowerShell 时都进行设置。 PowerShell 是否有配置文件?类似于 Unix 上的 Bash 配置文件?

最佳答案

如果在 PowerShell session 期间的某个时间,您需要查看或临时修改 PATH 环境变量,您可以键入以下命令之一:

$env:Path                             # shows the actual content
$env:Path = 'C:\foo;' + $env:Path     # attach to the beginning
$env:Path += ';C:\foo'                # attach to the end

关于windows - 设置 Windows PowerShell 环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/714877/

相关文章:

powershell - 如何使用 Powershell 管理多个 AzureRM 帐户

powershell - 如何检测Azure Powershell session 是否已过期?

c++ - 如何使用 C++ 观看 winapi dll 函数调用

c++ - 关于 MSDN 代码示例, "Enabling and Disabling Privileges"

powershell - 获取广告组-过滤器 "SID -like ' *-51 2'"

regex - 查找所有长度大于 N 的行

json - 从类型 JSON 属性中提取属性

windows - 如何以编程方式判断 Windows PE 文件是控制台子系统还是 Windows 子系统?

php - 我如何从网络 Web 服务器在网络客户端上创建文件

windows - 如何使用 Vagrant shell/path provisioner 配置 Windows 客户机?