如何使用Powershell在名称中设置带点的环境变量?

时间:2018-08-10 10:37:59

标签: powershell

我想在Powershell中设置名称为点的环境变量。 这行抛出错误:

$env:Test.Env.Var1 = "test111"

The property 'Var1' cannot be found on this object. Verify that the property exists and can be set.
At line:1 char:1
+ $env:Test.Env.Var1 = "test111"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

是否可以在不使用[Environment]::SetEnvironmentVariable方法的情况下设置“ Test.Env.Var1”变量?

1 个答案:

答案 0 :(得分:0)

这可以通过

完成

${env.test.value} = 'value'

source

感谢@ 4c74356b41在评论中提供了答案。

相关问题