Powershell - changing the value of an environment

2019-04-28 03:08发布

Is there a way to change the value of an environment variable (system) through powershell? I have only been able to change the value manually and see the change after restarting powershell. Context: We are trying to dynamically set the value of an indirect SSIS configuration and the configuration file is different per environment.

1条回答
看我几分像从前
2楼-- · 2019-04-28 03:49

To set an environment variable at the system level (and make them persistent), you need to use the .Net Framework method [Environment]::SetEnvironmentVariable()

In the current session, you can set them via $env:NAME = VALUE.

See http://technet.microsoft.com/en-us/library/ff730964.aspx

查看更多
登录 后发表回答