Powershell and cmd environment variables

佐手、 提交于 2019-12-31 04:03:16

问题


I use a batch script to set some environment variables local to that shell. When I launch PowerShell from that command prompt, I was expecting those environment variables to be available in the PowerShell script. But I don't see that happening.

Can someone help me what I'm missing?


回答1:


Those environment variables should be there in PowerShell but you have to access them using the Environment provider e.g.:

$env:foo

where foo is the environment variable name.



来源:https://stackoverflow.com/questions/27109319/powershell-and-cmd-environment-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!