-
Notifications
You must be signed in to change notification settings - Fork 2k
Setting up Environment Variables
Many tasks with Cmder will need you to set the correct %CMDER_ROOT%
environment variable path in your system.
Follow the instructions below to define it:
- Press ⊞ Win + Pause / Break to open the System Preferences, then click on Advanced system settings → Environment Variables.
- In System variables, look for a variable named
CMDER_ROOT
. If it's not already defined, click onNew…
to add a new variable as follows.- When you've installed portable Cmder in your user profile, set it under
User variables
instead. - If the variable already exists, only check if the value is correct, replace the value if it's not.
There is no need to create duplicate variables.
- When you've installed portable Cmder in your user profile, set it under
- Set the environment variable called
CMDER_ROOT
to point to the path of your Cmder root installation folder
(e.g.C:\apps\cmder
,C:\Program Files (x86)\Cmder
, or wherever you've installed Cmder.)
Cmder comes with ConEmu as the console emulator. In case %ConEmuDir%
is also not defined in your system, you could follow the steps 1-3 from above, and use the following values when creating your variable:
- Variable Name:
%ConEmuDir%
- Value: [cmder_root]\vendor\conemu-maximus5
e.g.:
C:\apps\cmder\vendor\conemu-maximus5
We recommend adding your Cmder installation directory to the path
variable. It has the benefit of launching Cmder from the explorer, the terminal, and the start menu.
Here's the quick steps to add Cmder to %PATH%
:
-
Open the system environmental variables (Win + Pause/Break → Advanced system settings → Environment Variables.)
-
Select
PATH
in either User variables or System variables, depending on whether you've put Cmder on a user folder (e.g.C:\Users\Samuel\Dropbox\apps\Cmder
) or in a system-wide directory (e.g.C:\apps\Cmder
). -
Click Edit… to display the PATH variable.
Depending on your Windows version, you might see different dialogs.
If you see the following window, simply click New and type in your Cmder directory, example:C:\bin\Cmder
If you see a single-line field, simply append the Cmder directory, like this:
;C:\bin\Cmder
So that
C:\test1;C:\test2
now becomesC:\test1;C:\test2;C:\bin\Cmder
. -
Hit OK to save the results.
-
You might need to Sign off and login again in order to make Windows take the new
PATH
into effect.
For more information, please also read this guide.
-
Open a new
Cmd
terminal. -
Type the following:
where cmder.exe
Tip: You can also query any other executable name, such as flute.exe
, bash.exe
, etc. to find their paths.
- Check the results:
-
If the executable is present in any of the
%PATH%
environment variable paths, you'll get the full path to the executable (multiple if found in more than one paths). -
Otherwise, you'll get the following error message:
INFO: Could not find files for the given pattern(s).
Cmder can be used in a variety of different settings, and supports many external options and configurations to fit with your needs.
When integrating, modding and/or using Cmder, you may often find the need of referring to the absolute path in which the Cmder is installed, e.g.: C:\apps\cmder
or C:\Program Files\Cmder
. We usually refer to this directory as [cmder_root] as in our documents and the Wiki.
When you set the system %CMDER_ROOT%
environment variable, you assign a fixed path to configuration files and avoid correcting the path each time you change the directory -- and if it changes, you only have to modify the variable once, instead of going through different configuration files and changing the values there.
Here's a list of comparison between the two methods:
-
You can skip setting up the
%CMDER_ROOT%
variable, as long as:- the path isn't going to change (e.g. you won't move the directory)
- you refer to the path by other files only once (or a few times at most)
- or maybe you are just testing things out before setting it up properly to use alongside your configuration files.
-
The only situation that we advise against setting the environment variable is when you use Cmder on a temporary computer (e.g. launching Cmder from a USB stick on university lab computers).
It is, however, strongly recommended to set a properly defined environment variable to point to the installation directory of Cmder.
Note: As a rule of thumb, if you enable Context-menu integration, you should also make sure that the %CMDER_ROOT%
environment variable is also defined.
You can use %CMDER_ROOT%
in place of the [cmder_root] placeholder wherever you see it in the documents and the Wiki. Example:
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.shellArgs.windows": [
"/k", "[cmder_root]\\vendor\\init.bat"
],
becomes:
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.shellArgs.windows": [
"/k", "%CMDER_ROOT%\\vendor\\init.bat"
],