Don't refresh PATH user environment variable values in ConEmu without Windows reboot

3

1

1. Summary

Values of PATH user environment variable don't refresh for me, if I work in ConEmu. I need to restart Windows.

2. Expected behavior

I use Chocolatey refreshenv script. If I run refreshenv in Hyper terminal or Clink:

C:\Users\SashaChernykh>zeal
'zeal' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\SashaChernykh>refreshenv
Refreshing environment variables from registry for cmd.exe. Please wait…Finished..

C:\Users\SashaChernykh>zeal

Zeal successful run for me.

3. Actual behavior

In ConEmu:

C:\Program Files\Far Manager>zeal
'zeal' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\Far Manager>refreshenv
Refreshing environment variables from registry for cmd.exe. Please wait…Finished..

C:\Program Files\Far Manager>zeal
'zeal' is not recognized as an internal or external command,
operable program or batch file.

4. Steps to reproduce

I download Zeal program via Chocolatey → I add C:\Program Files (x86)\Zeal —— path to zeal.exe in my User environment variable via Rapid Environment Editor:

RapidEE

Ctrl+S.

I get expected behavior for Clink and Hyper and actual behavior for ConEmu.

5. Not helped

  1. Refreshenv Chocolatey script,
  2. explorer.exe restart,
  3. Close all windows and tabs of all my terminals,
  4. resetvars.vbs script,
  5. ConEmuC /export PATH.

6. Do not offer

  1. Please, do not offer restart Windows. It takes a lot of time.

7. Environment

Operating system and version:
Windows 10 Enterprise LTSB 64-bit EN
ConEmu:
170118 [64]
{Far} mode

Саша Черных

Posted 2017-02-26T08:52:48.937

Reputation: 543

Just a comment: For what you're trying to do (and seeing all the other path entries you have), an App Paths key would be better I suspect. https://channel9.msdn.com/Shows/Defrag-Tools/Defrag-Tools-133-App-Paths.

– HelpingHand – 2017-02-26T09:04:38.813

Answers

4

For me its OK just if I close all conemu.exe or conemu64.exe (or even conhost.exe or cmd.exe if any, but they shouldn't affect ConEmu) processes and then just start ConEmu, take a look:

But note one important thing:

If you start ConEmu(or any other program) from another program like launcher or by hot-key created by another program or even by mouse gesture(using something like Strokes Plus) you need to restart that program to make that program to receive new environment variables/values, which will be given to child programs, you can see which are child processes and which are parent ones in program like Process Explorer or Process Hacker. So in order to child receive right environment variables/values you need to restart its parent(if you call child from parent).

BladeMight

Posted 2017-02-26T08:52:48.937

Reputation: 360

Blade Might, thanks for answer! 2 questions. 1) Why in ConEmu don't work refreshenv command like other terminals? Is any way, that it works? 2) Your method don't work for me, if I run ConEmu via ConEmu Sublime Text package. I run ConEmu via Sublime Text package → I change my environment variable use setx → I close ConEmu and Sublime Text → I run ConEmu via Sublime Text package → environment variable don't change for me. Thanks.

– Саша Черных – 2017-03-15T06:24:31.617

1) It actually works for me... 2) Following exactly what you said it works for me too... Maybe your Sublime Text(or ConEmu) stays in memory(or tray), or something like that? – BladeMight – 2017-03-15T10:16:55.900

Maybe your Sublime Text(or ConEmu) stays in memory(or tray), or something like that? — I check — I don't have Sublime Text and ConEmu process, if I reproduce the problem. // You use ConEmu in Far mode? – Саша Черных – 2017-03-15T10:21:54.273

You use ConEmu in Far mode? Yes and No. But in gif above - No. 1) Here how refresh env works for me: http://uploads.ru/sx1jE.gif Script i used: https://github.com/chocolatey/chocolatey/blob/master/src/redirects/RefreshEnv.cmd – BladeMight – 2017-03-15T10:44:58.577

1I use Autohotkey to start cmder (which is a wrapper of ConEmu) and met the same problem. The solution is quit the ahk script and start it again. Now the %PATH% variable is updated. – Chad – 2017-07-18T07:28:12.900