-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Setting up Environment Variables
For installations of Cmder, it is strongly recommended to define a fixed system variable path to use in your configuration files.
Here's how to do 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 variablesinstead. - 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_ROOTto your root Cmder installation folder (e.g.C:\Program Files (x86)\Cmder, or wherever you've installed Cmder.)
With this method, you avoid correcting the path each time you use it, and if it changes, you only have to change it once.
Cmder by default uses ConEmu as the console emulator. In case %ConEmuDir% is also not defined in your system, you could follow the same steps 1-3 from above, but instead 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
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.
Please use %CMDER_ROOT% wherever you see the [cmder_root] placeholder 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"
],Yes, most definitely. Here's a list of comparison between two methods:
-
You should know that not using this method is only fine 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).
-
However, it is strongly recommended to use a properly defined environment variable to refer to the installation directory of Cmder.
Tip: As a rule of thumb, if you enable Context-menu integration, you should probably define the %CMDER_ROOT% environment variable.