powershell 设置环境变量

cmd 是用set 导出变量,到了powershell中不好使了,下面介绍下导出变量的方法,比如想设置
ETCDCTL_API=3

在powershell中执行下面命令就可以了

$Env:ETCDCTL_API=3

比如想在环境变量的PATH下添加一条内容,用如下命令,注意要在路径之前添加“;”

$Env:path=$Env:Path+";C:\Go\bin"  

移除变量

remove-item env:ETCDCTL_API

参考

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-6
http://xahlee.info/powershell/environment_variables.html
https://baike.baidu.com/item/powershell命令别名/15969466