7

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?

3 Answers 3

6

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.

1
  • That is exactly the case I've encountered and with the right solution!
    – xing
    Commented May 13, 2015 at 22:20
4

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%"
0

Absolutely wrong.

cmder is a ConEmu actually. And ConEmu do not "import" variables. Instead, as actually all Windows applications do, ConEmu inherit variables from the parent process. That can be easily checked with ProcessExplorer.

1
  • Actually that is not the cause. In the process explorer conemu.exe is a top level process. And finally I've found the reason: There is a "&" inside one of my paths, and cmder can not understand that, and treat the part before "&" as a command which fails for sure, and the rest of the paths is omitted.
    – xing
    Commented May 11, 2015 at 1:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .