Why cmder does not import the user path variables?

The path variable in the cmder only contains those paths imported form the system path variable. While in normal command shell, the system path and user path will be concatenated.

I've found in the cmder_dir\vendor\init.bat the following lines:

:: Enhance Path
@set git_install_root=%CMDER_ROOT%\vendor\msysgit
@set PATH=%CMDER_ROOT%\bin;%git_install_root%\bin;%git_install_root%\mingw\bin;%git_install_root%\cmd;%git_install_root%\share\vim\vim74;%CMDER_ROOT%;%PATH%

But obviously only system path is included in the %PATH% above.

How could I add the user path to it?


As you have already found out, %PATH% in the init.bat does include the user path. The problem however isn't entirely cmders fault. It has something to do with DOS, or the batch file.

For example with PATH as

C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4 & MySQL Utilities 1.5.4 1.5\

The line

@set PATH=%OTHER_PATHS%;%PATH%

gets replaced to

@set PATH=C:\OTHER\PATHS;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4 & MySQL Utilities 1.5.4 1.5\

And it apparently gets interpreted as

@set PATH=C:\OTHER\PATHS;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4 & 
MySQL Utilities 1.5.4 1.5\ #separate line/command

Which resulted in cmder trying to execute MySQL with the rest of the line as the parameters.

This phenomenon also caused your user path to drop from the path cmder uses, resulting in you not being able to use your user defined paths. Did cmder output anything when starting it up, or attempt to execute something?

For other people having issues with this, simply wrap the path with the & with double quotes. So in my case this would be

"C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4 & MySQL Utilities 1.5.4 1.5\"

This fixed it for me.

My knowledge with DOS and batch is quite small, those are just observations I have made through trial and error. I just found this out and wanted to share.


x1Bape is right, but alternatively you can fix it in the vendor/init.bat instead of changing the PATH.

Just modify the line under :: Enhance Path

@set PATH=%CMDER_ROOT%\bin;%PATH%;%CMDER_ROOT%

So it looks like this

@set "PATH=%CMDER_ROOT%\bin;%PATH%;%CMDER_ROOT%"