Powershell和cmd环境变量 [英] Powershell and cmd environment variables

查看:143
本文介绍了Powershell和cmd环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用批处理脚本将一些环境变量设置为该shell的本地。当我从该命令提示符启动PowerShell时,我期望这些环境变量在PowerShell脚本中可用。但是我没有看到这种情况发生。

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?

推荐答案

这些环境变量应该在PowerShell中,但您必须使用环境提供程序访问它们,例如:

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

$env:foo

其中 foo 是环境变量名。

这篇关于Powershell和cmd环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆