Cmder Console Emulator

repository·master·Indexed 12 days ago

https://github.com/cmderdev/cmder

A portable, highly configurable console emulator for Windows based on ConEmu. It features custom prompts, Monokai color schemes, and integrated tools like Clink. Supports multiple shells including CMD, PowerShell, and Bash, with modular configuration via profile.d scripts and user-specific alias files.

Tokens
3.9K
Snippets
10
Records
18
Agent score
99%

What's inside Cmder

  1. Understand the role of the Bin folder

    master
    The bin folder contains executable files and scripts. At runtime, this folder is automatically injected into your PATH environment variable, allowing you to run Cmder-related commands and binaries directly from any terminal session without specifying the full path.
  2. Upgrade Cmder

    master

    The upgrade process depends on whether you are running a newer version (which uses user-specific config files) or an older version.

    Important Note: Avoid manually editing files under [cmder_root]/vendor. All user customizations should be placed in the [cmder_root]/config folder to ensure they persist through upgrades. If you have edited files in vendor, back them up and re-apply them after the upgrade.

    For Newer Versions

    (If you have [cmder_root]/config/user[-|_]conemu.xml)

    1. Exit all Cmder sessions and relaunch [cmder_root]/cmder.exe. This automatically backs up your existing [cmder_root]/vendor/conemu-maximus5/conemu.xml to [cmder_root]/config/user[-|_]conemu.xml.
    2. Backup any manually edited files in [cmder_root]/vendor.
    3. Delete the [cmder_root]/vendor folder.
    4. Extract the new cmder.zip or cmder_mini.zip into [cmder_root]/, overwriting all files when prompted.

    For Older Versions

    (If you do NOT have [cmder_root]/config/user[-|_]conemu.xml)

    1. Exit all Cmder sessions and manually backup [cmder_root]/vendor/conemu-maximus5/conemu.xml to [cmder_root]/config/user[-|_]conemu.xml.
    2. Backup any manually edited files in [cmder_root]/vendor.
    3. Delete the [cmder_root]/vendor folder.
    4. Extract the new cmder.zip or cmder_mini.zip into [cmder_root]/, overwriting all files when prompted.
  3. Run external shells (WSL, Cygwin, MSys2) in Cmder

    master

    You can run external Unix-like environments as new tasks in Cmder:

    1. Press <kbd>Win</kbd> + <kbd>Alt</kbd> + <kbd>T</kbd> and click the + button.
    2. Name the task.
    3. In the Commands box, enter: cmd /c "[path_to_external_env]\bin\bash --login -i" -new_console

    To enable portable settings in external shells: Copy the vendor/cmder_exinit file to the external environment's /etc/profile.d/ folder (e.g., /etc/profile.d/cmder_exinit.sh for bash).

    In the copied script, ensure CMDER_ROOT is set if launching from outside Cmder:

    # CMDER_ROOT=${USERPROFILE}/cmder
    cmd /c "C:\Cygwin\bin\bash --login -i" -new_console
  4. Define Aliases for different shells

    master

    Aliases allow you to create shortcuts for commands. The method for making them permanent depends on the shell.

    Cmder (cmd.exe)

    Use alias name=command. Supports parameters via $1-9 or $* (e.g., vi=vim.exe $*). To make permanent: Add to %CMDER_ROOT%\config\user_aliases.cmd or %CMDER_ROOT%\config\user_profile.cmd.

    Bash / Mintty

    Use native alias name=command. Aliases created via command line are session-only. To make permanent: Add to $CMDER_ROOT/config/user_profile.sh (portable) or $HOME/.bashrc (non-portable).

    PowerShell

    Use native Set-Alias. Complex aliases with parameters are not supported. To make permanent: Add to $ENV:CMDER_ROOT\config\user_profile.ps1.

  5. Set up shell-specific user configurations and profile scripts

    master

    You can add custom startup commands or environment variables by editing specific profile files or by dropping scripts into the profile.d directory.

    1. Edit Profile Files

    ShellPortable User Config File
    Cmder (cmd.exe)%CMDER_ROOT%\config\user_profile.cmd
    PowerShell$ENV:CMDER_ROOT\config\user_profile.ps1
    Bash/Mintty$CMDER_ROOT/config/user_profile.sh

    Note: Bash/Mintty sessions also source $HOME/.bashrc after the Cmder profile.

    2. Use profile.d for modular scripts

    Drop scripts into %CMDER_ROOT%\config\profile.d to have them automatically loaded:

    • Cmder: *.cmd or *.bat
    • PowerShell: *.ps1
    • Bash/Mintty: *.sh
  6. Add optional user packages to the PATH

    master

    The Bin folder contains optional user packages that are not automatically added to your system PATH. To include a specific folder from the Bin directory in your environment PATH, you must manually inject it using the %lib_path% enhance_path command within your Cmder configuration files.

    You can add this command to:

    1. %cmder_root%\config\user_profile.cmd
    2. Any .cmd file located in %cmder_root%\config\profile.d\
    %lib_path% enhance_path "%cmder_root%\Bin\path_to_your_folder"
  7. Install Cmder for Single User Portable Config

    master

    To use Cmder as a fully self-contained, portable package (ideal for USB sticks or cloud storage), follow these steps:

    1. Download the latest release.
    2. Extract the archive to a folder. Important: Do not extract to C:\Program Files or any location requiring Administrator privileges to modify configuration files.
    3. (Optional) Place your own executable files into the %cmder_root%\bin folder. These will be automatically injected into your PATH.
    4. Run Cmder.exe.
    # Example directory structure for portable mode
    # C:\cmder\bin\<your_tools>
    # C:\cmder\Cmder.exe
  8. Integrate Cmder into the Windows Context Menu

    master

    To add a "Cmder Here" option to your Windows File Explorer right-click menu, you must register the shell menu shortcut using an Administrator prompt.

    1. Open a terminal as an Administrator.
    2. Navigate to the directory where Cmder is installed.
    3. Execute the registration command: .\cmder.exe /REGISTER ALL

    If you receive an "Access Denied" error, ensure you are running the terminal with elevated Administrator privileges.

    # Run this from an Administrator terminal inside the Cmder folder
    .\cmder.exe /REGISTER ALL
  9. Use the Profile.d folder to run startup scripts

    master

    The profile.d folder allows you to execute custom scripts automatically whenever a new shell session starts. You can add files with specific extensions to this folder, and Cmder will execute them using the corresponding shell type.

    Supported file extensions and their associated shells:

    • *.sh: Executed by a POSIX-compatible shell (e.g., Bash).
    • *.cmd: Executed by the Windows Command Prompt (cmd.exe).
    • *.ps1: Executed by PowerShell.
    # Example: Create a file named 'my_startup.cmd' in the profile.d folder
    echo "Welcome to your Cmder session!"
  10. Install Cmder with Shared Install and Non-Portable Individual User Config

    master

    Use this method to have a shared Cmder installation (e.g., on a network drive) while keeping user-specific configurations and binaries in the user's profile.

    1. Download the latest release and extract it to a shared location.
    2. (Optional) Add custom executables or app folders to %cmder_root%\bin (injected into PATH) or %cmder_root%\opt (NOT injected into PATH).
    3. Run Cmder.exe with the /C argument pointing to a directory in the user profile. For example: cmder.exe /C %userprofile%\cmder_config

    This creates the following structure in the user profile:

    • %userprofile%\cmder_config\bin (Injected into PATH)
    • %userprofile%\cmder_config\config\profile.d
    • %userprofile%\cmder_config\opt (NOT injected into PATH)
    # Launching with a custom user config directory
    cmder.exe /C %userprofile%\cmder_config
  11. Configure Cmder shell startup behavior using Task Arguments

    master

    You can pass custom arguments to init.bat to change how Cmder initializes. To do this:

    1. Press <kbd>Win</kbd> + <kbd>Alt</kbd> + <kbd>T</span>.
    2. Select a task (e.g., {cmd::Cmder}).
    3. Append arguments to the command string using this format:
    cmd /s /k ""%ConEmuDir%\..\init.bat" [ADD ARGS HERE]"

    Supported init.bat Arguments

    ArgumentDescriptionDefault
    /c [user cmder root]Enables user bin and config folders for 'Cmder as admin' sessionsnot set
    /dEnables debug outputnot set
    /fEnables Cmder Fast Init Mode (disables some features)not set
    /tEnables Cmder Timed Init Mode (displays init script runtime)not set
    /git_install_root [path]User specified Git installation root path%CMDER_ROOT%\vendor\Git-for-Windows
    /home [folder]User specified folder path to set %HOME% environment variable%userprofile%
    /max_depth [1-5]Max recurse depth for adding %cmder_root%\bin to PATH1
    /nix_tools [0-2]How *nix tools are added to PATH (0: None, 1: Prefer Windows, 2: Prefer *nix)1
    /svn_ssh [path]Defines %SVN_SSH% for git svn%GIT_INSTALL_ROOT%\bin\ssh.exe
    /user_aliases [path]File path for user aliases%CMDER_ROOT%\config\user_aliases.cmd
    /vEnables verbose outputnot set
    (custom arguments)User defined arguments processed by cexecnot set
    cmd /s /k ""%ConEmuDir%\..\init.bat" /git_install_root C:\Git /home C:\MyHome"