Msys2 does not have environment variables in Windows

problem description

for example, I installed jdk and set it in the system environment variables. Executing java or javac on the command line can execute the relevant commands, but I can"t find java, in msys2 and prompt me that I can"t find the command.

I use export | grep PATH to check the environment variables in msys2 and find that except for the directories that come with msys2, there are only four paths: System32, Windows, Wbem and PowerShell. There are no AnaConda, Git and Java that I configured before, and the relevant commands cannot be executed. You can"t find it on the msys2 command line with the where command. But everything is fine at the windows command prompt and powershell, as well as in git-bash.

what should be set to make the environment variable of msys consistent with that of windows system? Is there a better way to add one by one manually?

in addition, if you are booting from cmder, how should you configure it to be consistent with the system environment variables?

Apr.14,2021

you can create a Windows environment variable MSYS2_PATH_TYPE=inherit , wait for this environment variable to take effect, and then open msys2's mintty.

< hr >

in fact, foreign friends have already solved this problem for you, and there are many ways to check out https://sourceforge.net/p/msy..

Menu