DEV Community

Kagunda JM
Kagunda JM

Posted on • Originally published at kags.me.ke

Windows 10 - Setup Cmder

Alt "cmder root environment variable setup"

What is Cmder

Cmder is a commander console for Windows. The opening line on Cmder's website explains it all.

Cmder is a software package created out of pure frustration over the absence of nice console emulators on Windows. It is based on amazing software, and spiced up with the Monokai color scheme and a custom prompt layout, looking sexy from the start.

All the magic of Cmder happens through use of ConEmu - a console program for windows and Clink which gives it a powerful bash style command line editing, completion, history and much more.

Features

Cmder packs a huge list of features and the following are some highlights of the available features:

  • Implements Git for Windows
  • Very portable. It designed with no external dependencies. You can just package it in a folder, put it on a USB stick and use it from anywhere on any system
  • Look and Feel. Has a wide range of customizable themes (color schemes) you can choose from
  • Offers powerful customization options
  • Has awesome shortcuts which makes you much more productive making your life easier
  • Makes it simple to copy and paste with multiple methods of doing it such as Ctrl+C and Ctrl+V
  • Has syntax highlighting for things like bash scripts and git repository folders
  • Multiple tabbed consoles with an option of renaming the tabs to give you better context. Tabs can be configured to appear at the top instead of bottom which is the default
  • Allows creation of custom tasks which you can run by name or hot key
  • Powerful search capabilities with a search box built right into the interface
  • allows use of Unix commands like ls, rm, chmod, curl ,ssh, vim and many more.

Installation

To install, visit Cmder website and under the downloads section, download either the mini or full version. The full version includes Git for Windows.

After downloading, extract the archive to a local folder that would not require Administrator access for modifying the configuration files. In this article, lets extract intto C:\MyApps\Cmder folder. The location where you have extracted the files will be the CMDER_ROOT. Navigate to the folder where you have extracted the files and open Cmder.exe.

Setup CMDER_ROOT, %ConEmuDir% and %PATH% Environment Variables

  • Within Windows, search for environment variables and click Edit the system environment variables to open
  • When the System Properties window opens, click on Enviroment Variables button.
  • Below System variables section, click New... button
  • Under Variable name, type CMDER_ROOT and within Variable value: type or browse to your Cmder root installation folder and click OK to go back to the Environment Variables window.

Alt "cmder root environment variable setup"

  • Click the New... button again to setup %ConEmuDir% environment variable. Use following values:
    • Variable Name: %ConEmuDir%
    • Variable values: [cmder_root]\vendor\conemu-maximus5

Alt "conemu environment variable setup"

  • Click OK button to save the changes.
  • To update the PATH variable, select PATH under System variables and click Edit...
  • Click New button to and type or browser location for the Cmder folder and click OK to save the changes and click OK.

Alt "Path environment variable setup"

  • Click OK another two times to close the previous opened dialogs
  • Restart the computer in order for the new PATH changes to take effect
  • Open command prompt (cmd.exe) and type where cmder. Your results should display the full path to the Cmder.exe.

Alt "cmder where location command"

Cmder Settings

Cmder has many settings that can be configured. Here we look at how to change settings for two of the available settings.

  • Open Cmder, click on Cmder icon on top left corner of the window and select Settings
  • To have opened tabs appear at top the window instead of the bottom which is the default, under General click on Tab bar and un-check Tabs on bottom
  • To change theme, select Features, Color and either change colors to your liking or select from under Schemes

Alt "cmder settings screen"

Launch Cmder from cmd.exe

  • Create a cmder_shell.bat with the following contents:
@if "%cmder_init%" == "1" (goto :eof) else (set cmder_init=1)
@pushd %CMDER_ROOT%
@call "%CMDER_ROOT%\vendor\init.bat" /f
@popd
  • Save the file to Cmder installation folder
  • Open Windows cmd, type cmder_shell and press the ENTER key. This will open the Cmder's shell within the CMD window.

Add Cmder shell to AutoRun

  • Open RegEdit.exe
  • Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor
  • Right click Command Processor and select New > String Value.
  • Change the New Value name to AutoRun
  • Right click on the AutoRun, select Modify and set value to cmder_shell.bat and click OK
  • Close the Registry Editor

Alt "cmder registry autorun key"

Now every time you open the CMD.EXE, you'll have the Cmder shell in your terminal

Context Menu Integration

  • Open a CMD terminal as an Administrator
  • Navigate to the directory you have place CMDER
  • Execute .\cmder.exe /REGISTER ALL
  • In a file explorer window right click on any directory and you should see Cmder Here in the context menu.

Integrating VS Code Terminal

  • Open VS Code
  • From the menu select File > Preferences and click on Settings
  • Search for settings.json
  • Click Edit in settings.json
  • Append the following into your configuration file. Make sure to replace [cmder_root] and %CMDER_ROOT% with the actual Cmder root path.
  "terminal.integrated.shell.windows": "cmd.exe",

  "terminal.integrated.env.windows": {
  "CMDER_ROOT": "[cmder_root]"
  },
  "terminal.integrated.shellArgs.windows": [
    "/k",
    "%CMDER_ROOT%\\vendor\\bin\\vscode_init.cmd"
  ],
  • Close and re-open VS Code. From the menu, Select View from the menu and click on Terminal.

Setting up Aliases

You can define simple aliases with a command like alias name=command. Aliases support optional parameters using $1-9 or $* characters. User aliases are defined and stored in %CMDER_ROOT%\config\user_aliases.cmd file.

cmderr is default alias for changing directory to the defined cmder_root. If you have setup the environment variable, open a cmder terminal and type cmderr and press the ENTER key. This should take you to the root directory of Cmder. To append more aliases to the file, open the file using your favoured editor and add any aliases you may requirre.

One alias that I frequently use is the tilde (~) to navigate to my home directory. The alias is defined using ~=cd "C:\\Users\\Kagunda JM". Always remember to double quote paths which have spaces.

After you have defined your aliases, restart the terminal for the changes to take effect. Thereafter, you can start using the aliases to perform those repetitive tasks.

Alt "Cmder user aliases file"

Resources

Top comments (0)