-
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.
-
Note: You can also open Advanced system settings by typing
SystemPropertiesAdvanced.exe
orsysdm.cpl
into the Run Menu.) - Note: From Windows 11 and onwards, the keyboard shortcut opens the System Settings app instead. From there, expand the Device specificatins and then click on Advanced system settings link.
-
Note: You can also open Advanced system settings by typing
- In the Advanced system settings window, look for the Environment Variables, then:
- If you installed Cmder to a directory for all users, look at System variables. (For example,
C:\Program Files
,C:\utils
,C:\tools
) - If you installed Cmder in portable mode, look at User variables. (For example,
C:\Users\Username\
and any path below it)
- If you installed Cmder to a directory for all users, look at System variables. (For example,
- 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.)- If the variable
CMDER_ROOT
is not defined, click onNew…
and add the variable. - 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.
- If the variable
Note: If the Cmder installation path is something like C:\Program Files
, it should go into the System variables. If it's something like C:\Users\YourUsername\AppData
, then it should go into the User variables section.
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 comparisons 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 in which 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"
],