Skip to content

Setting up Environment Variables

David Refoua edited this page Aug 5, 2018 · 17 revisions

Setting up environment variables

What is this referring to?

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.

You should know that using this method is fine as long as the path isn't going to change, and you refer to it by other files only once (or a few times at most); and/or you are just testing things out before setting it up properly to use alongside your configuration files.

How to properly set-up the %CMDER_ROOT% variable?

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:

  1. Press Win + Pause/Break to open the System Preferences, then click on Advanced system settingsEnvironment Variables.
  2. In System variables, look for a variable named CMDER_ROOT. If it's not already defined, click on New... to add a new variable as follows. (If you've installed portable Cmder in your user profile, set it under User variables instead.)
  3. Set the environment variable called CMDER_ROOT to 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.

Examples

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"
  ],

Some additional steps

Setting up %ConEmuDir%

Cmder by default uses ConEmu as the console emulator. In case %ConEmuDir% is also not defined in your system, you could follow the sames 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

If the variable already exists, only check if the value is correct. There is no need to create duplicate variables.

Clone this wiki locally