启动Windows命令提示符时,如何做才能导致环境变量发生变化? [英] What did I do to cause environment variables to change when I start the Windows command prompt?

查看:65
本文介绍了启动Windows命令提示符时,如何做才能导致环境变量发生变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows 10 x64.我已经安装了Anaconda3.如果我在没有其他任何运行的情况下启动C:\ Windows \ system32 \ cmd.exe(并且在后台看不到任何有趣的东西),则会将以下内容添加到控制面板" UI中不存在的PATH变量的前面: C:\ Users \ me \ Anaconda3 \ condabin \ .

I am using Windows 10 x64. I have Anaconda3 installed. If I start C:\Windows\system32\cmd.exe with nothing else running (and nothing interesting in the background that I can see), the following is added to the front of my PATH variable that is not present in the Control Panel UI: C:\Users\me\Anaconda3\condabin\.

我还看到添加了其他一些环境变量,这些变量在控制面板" UI中也不存在:

I also see some other environment variables added, which again are not present in the Control Panel UI:

CONDA_BAT=C:\Users\me\Anaconda3\condabin\conda.bat
CONDA_EXE=C:\Users\me\Anaconda3\Scripts\conda.exe
CONDA_SHLVL=0

除了没有显示在控制面板UI中之外,当我在Powershell中运行 ls env:时,上述环境变量也不会出现在输出中.

In addition to not showing up in the control panel UI, the environment variables described above do not appear in the output when I run ls env: in powershell.

可能是什么原因造成的?我认为这可能是我设置的.我绝对喜欢它,但是我不知道是什么原因或如何复制它.有什么想法吗?

What could be causing this? I think it might be something I set up. I definitely like it, but I don't know what causes it or how to reproduce it. Any ideas?

此问题中,回答者解释说这可以由其他启动器启动cmd.exe引起的;但是,那不是我在做什么.

In this question the answerer explains that this can be caused by launching cmd.exe from some other launcher; however, that's not what I'm doing.

推荐答案

Reddit用户 4wh457 SO用户 JosefZ 解决了我的问题.事实证明,我在HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor中使用以下属性(在RegCool界面中)创建了一个注册表项:

Reddit user 4wh457 and SO user JosefZ solved my problem. It turns out that I created a registry key in HKEY_CURRENT_USER\Software\Microsoft\Command Processor with the following properties (in the RegCool interface):

  • NAME =自动运行

  • NAME = AutoRun

类型= REG_EXPAND_SZ

Type = REG_EXPAND_SZ

数据=如果存在"C:\ Users \ me \ Anaconda3 \ condabin \ conda_hook.bat""C:\ Users \ me \ Anaconda3 \ condabin \ conda_hook.bat"

Data = if exist "C:\Users\me\Anaconda3\condabin\conda_hook.bat" "C:\Users\me\Anaconda3\condabin\conda_hook.bat"

JosefZ ,自动运行键也可能在这里:

Per JosefZ, the AutoRun key could have also been here:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

(其他文档此处).

这篇关于启动Windows命令提示符时,如何做才能导致环境变量发生变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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