cmderdev / cmder

Lovely console emulator package for Windows
https://cmder.app
MIT License
25.74k stars 2.02k forks source link

Question: Linux commands not working after running "RefreshEnv" #2880

Closed DrissBoumlik closed 9 months ago

DrissBoumlik commented 9 months ago

Question

Hello Cmder Team

I installed chocolatey in order to refresh the env variables without restarting cmder and the issue is when I run RefreshEnv I can no longer run linux commands such as alias, ls, touch ... etc Message I get 'ls' is not recognized as an internal or external command, operable program or batch file.

is there a way to reload linux command, I tried running %CMDER_ROOT%\vendor\init.bat but nothing changed. the idea is to stay in the current cmder. Can you help with this please

Thank you

Checklist

daxgames commented 9 months ago

No idea what you are talking about. Can you clarify?

Chocolatey is a way to install Cmder. We have nothing to do with it.

What does 'I installed chocolatey in order to refresh the env variables without restarting cmder' mean?

What is RefreshEnv?

What does 'is there a way to reload linux command' mean?

chrisant996 commented 9 months ago

I think it's referring to this: https://docs.chocolatey.org/en-us/create/functions/update-sessionenvironment

PowerShell and Chocolatey don't know about Cmder or the scripts Cmder runs to initialize environment variables, so refreshenv doesn't re-initialize Cmder.

I think the OP wants to know what additional step to run after refreshenv, to re-initialize the Cmder environment variables (especially the changes to PATH). And if the PATH is getting set up by ConEmu, then it might be more complicated to refresh than just running a script.

DrissBoumlik commented 9 months ago

In my case I want to edit the PATH variable without restarting the terminal (cmder), so when after searching, I found that it can be done by running RefreshEnv which is a chocolatey command line to reload the PATH changes, so here is what I do I run setx /m PATH New_Value and then refreshenv (requires cmder to be run with admin rights) this works fine but when I run alias or touch it shows that the command is not recognized as an internal or external command ... so yes what @chrisant996 said is pretty much what I'm asking, I want to know how cmder loads or recognizes the linux commands or simply how I can make it loads the updates I made in the environment variables (is this case PATH)

daxgames commented 9 months ago

To my knowledge what you are asking cannot be done without a restart of ConEmu. ConEmu is the terminal emulator.

You could ask the developer of ConEmu.

That could have undesired effects though since Cmder init.bat modifies the path known to ConEmu so you might not thet the results you expect.

Possibly a refreshenv then an init.bat might do the trick.

DrissBoumlik commented 9 months ago

Hi just in case someone has same issue The solution I found for now is to add Cmder\vendor\git-for-windows\usr\bin (where linux commands are loaded) & Cmder\vendor\bin (where alias.cmd exists) to the Path variable.