Skip to content

Seamless VS Code Integration

赵丰 (Zhao Feng) edited this page Jul 29, 2021 · 51 revisions

VS Code Terminal

To run Cmder as the VS Code terminal, you may follow these steps:

  1. Press Ctrl + , to access VSCode Settings

  2. Search for settings.json

  3. Click Edit in settings.json

  4. Append or modify the following into your configuration file:

    Note: Please make sure that CMDER_ROOT is configured under your Windows Paths, you can also substitute it with the path to your cmder installation. The below config produces a default Cmder terminal using Cmd.exe shell as if you launched Cmder.exe. The are only valid with Cmd.exe based shells and will have no effect if using Powershell or Bash. You need to modify windows to linux or osx based on your operating system.

    "": {
        "cmder": {
             "path": "C:\\WINDOWS\\System32\\cmd.exe",
             "args": ["/K", "C:\\Cmder\\vendor\\bin\\vscode_init.cmd"]

Tip: You can define an environment variable to use as [cmder_root].

  1. Press Ctrl + ` (Control-Tilde) to open VS Code's terminal.

  2. If you are running Cmder 1.3.16 or newer:

    Note: A generic vscode_init_args.cmd is created in one of the paths below on first run of vscode_init.cmd if it does not already exist.

    • Edit either the%cmder_root%\bin\vscode_init_args.cmd or the %cmder_user_bin%\vscode_init_args.cmd script to set appropriate Cmder settings for vscode according the scripts internal documentation.

      User Configured Cmder vscode_init_args.cmd Example:

      @echo off
      echo Applying Cmder VSCode settings from '%~0'...
      if defined CMDER_CONFIGURED (
          rem Set Cmder settings here for when VSCode is launched inside Cmder.
          rem The below causes Cmder to not rerun '%cmder_root%\config\profile.d\*.cmd' or 'user_profile.cmd' scripts because Cmder already ran them.
          set CMDER_CONFIGURED=2
      ) else (
          rem Set Cmder settings here for when VSCode is launched from outside Cmder.
          rem Do NOT add optional Unix tools to the path the same as 'init.bat /nix_tools=0'
          set nix_tools=0
          rem Enable Cmder `fast_init` same as 'init.bat /f'
          set fast_init=1
          rem Enable Cmder User config same as 'Cmder.exe /c c:\Users\%USERNAME%\.cmder'
          rem NOTE: This is non-default config and results in a non-portable config.
          rem       This is for example purposes only and should only be done if you understand WHY this is done!
          set cmder_user_bin=c:\Users\%USERNAME%\.cmder\bin
          set cmder_user_config=c:\Users\%USERNAME%\.cmder\config
      set verbose_output=1
      rem Set all required Cmder VSCode terminal environment settings above this line.
      echo Applying Cmder VSCode settings is complete!
    • close the previous VSCode Cmder terminal by typing exit[Enter] in the terminal.

    • Press Ctrl + ` (Control-Tilde) to open VS Code's terminal.

You may now use Cmder with VS Code.

👉 Please note the use of cmd.exe instead of cmder.exe. More…

👉 Cmder and VS Code both have a hotkey mapping for Ctrl + `. You need to change Cmder's mapping if you want to use VS Code's mapping. More...

For more information/issues, read our guide. Here's a demo.


Spaces in path

CAUTION: The command line interpreter in Windows has some issues with spaces in the path, such as C:\Program Files (x86)\Cmder. We do not recommended to install Cmder in a path that contains spaces.

Instead, we recommend installing Cmder in a path that does not contain any spaces, such as: C:\apps\Cmder or C:\tools\Cmder to avoid any conflicts with VS Code.

If you for some reason really need to launch Cmder from a path with spaces, you might need to prepend a ^ symbol before each space, such that C:\\Example Directory with Spaces\\Cmder will become C:\\Example^ Directory^ with^ Spaces\\Cmder in your settings.json file.

You may also have to escape the parentheses ( and ) as well as spaces. Here's an example:

C:\Program Files (x86)\Cmder  →  "C:\\Program^ Files^ ^(x86^)\\Cmder"

💾 Alternatively you could use 8.3 filename convention:

C:\Program Files\Cmder  →  "C:\\PROGRA~1\\Cmder"

(Use PROGRA~2 for Program Files (x86))


Install VS Code in portable mode

VS Code is able to work in portable mode. To install it as portable, just follow the official instructions and configure Cmder accordingly.

  • Extract the VSCode zip file to %CMDER_ROOT%\bin\vscode

  • Create %CMDER_ROOT%\bin\vscode\data to enable portable mode.

  • Create the below file in %cmder_root%\bin\vscode.cmd for launching VS Code Portable from Cmder:

    @call "%cmder_root%\bin\vscode\bin\code.cmd"
  • Start Cmder and type vscode.

  • Click File->Preferences, find and click Edit in settings.json.

  • Add the below to settings.json

      "": "cmd.exe",
      "": [


Use PowerShell instead of cmd.exe

Microsoft is trying to make PowerShell as the default shell for Windows 10. To integrate Cmder with VSCode using PowerShell, use the following settings. Everything else is the same as above.

    "": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",

    "": [
        "-ExecutionPolicy", "Bypass", 
        "-NoLogo", "-NoProfile", "-NoExit", 
        "-Command", ". 'C:\\apps\\cmder\\vendor\\conemu-maximus5\\\\..\\\\profile.ps1'"

Of course, you should set the location of the profile.ps1 file according to your installation directory.

Note the double backslashes which are required.

Also note that C:\apps\cmder\vendor\conemu-maximus5 would be the value of %ConEmuDir% ($env:ConEmuDir in PowerShell), but that environment variable is not available to VSCode unless you define it.


Automatically open vsCode at startup, as well as use its build-in terminal

Related to issue #1758, make sure your Cmder have the "%cexec%" feature.

In my case:

  1. I put vsCode into %cmder_root%\bin\vsCode folder,

(%cmder_root% is the environment variable of your Cmder installation directory.)

  1. I use the following variables as my configuration file:
"": [
  1. I use the following commands in user-profile.cmd to run vsCode at startup:
%ccall% NOT "/noautorun" "start" "%cmder_root%\bin\vsCode\Code.exe %*"


Use Cmder Embedded Git in VSCode

  1. Press Ctrl + , to access VSCode Settings
  2. Search for settings.json
  3. Click Edit in settings.json
  4. Update or add the following to your user settings:
    "git.enabled": true,
    "git.path": "[cmder_root]\\vendor\\git-for-windows\\cmd\\git.exe",

if it does not work, you can try another way

"": "[cmder_root]\\vendor\\git-for-windows\\bin\\bash.exe",

Substitute [cmder_root] with your Cmder installation directory.
Tip: You can define an environment variable to use as [cmder_root].

Optional Steps

Here's a list of unofficial extensions that you can install:

  • VSCodeCmder – Commands for VSCode to make it easier to use in a keyboard-only workflow

Known Issues

VS Code Tasks

There is currently an issue regarding the VS Code Tasks with Cmder. More info: