【发布时间】:2015-12-20 05:43:02
【问题描述】:
我正在尝试使用 PowerShell 在此处添加系统变量:
我已经尝试了两种方式使用
$env:MyTestVariable = "My test variable."
和
[Environment]::SetEnvironmentVariable("TestVariableName", "My Value", "<option>")
但是他们似乎都没有添加到这个部分。我也尝试过重新启动计算机,看看它是否会生效。我查看了 technet 以及无数其他网站,但我尝试过的都没有奏效。
如何使用 PowerShell 设置系统变量?
【问题讨论】:
-
[System.Environment]::SetEnvironmentVariable('name','value',[System.EnvironmentVariableTarget]::Machine)
标签: windows powershell environment-variables