How to use Cmder in Visual Studio Code?

another solution is you can set your cmder location into new path

image was from nikrolls when giving the solution

and just set in your settings.json

"terminal.integrated.shell.windows": "C:\\Windows\\system32\\cmd.exe",
"terminal.integrated.shellArgs.windows": [
    "/k %CMDER_ROOT%\\vendor\\init.bat"
]

you can find it on cmder github issue


Another approach.

The Cmder team suggests prepending a ^ character before each space in your path, instead of using the 8dot3 naming approach.

Example:

{
    "terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\cmd.exe",
    "terminal.integrated.shellArgs.windows": [
        "/k C:\\Program Files^ (x86)\\Cmder\\vendor\\init.bat"
    ]
}

Taken from official Cmder wiki:

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 for Test\\Cmder will become C:\\Example^ Directory^ for^ Test\\Cmder in your settings.json file.


After scouring the Internet for answers, I couldn't find a solution, but I figured it out and thought I might post it here for others to see, as I've seen that people from different forums had the same question but there was no answer.

In Windows, there is a /X for the dir command, which states:

  /X          This displays the short names generated for non-8dot3 file
              names.  The format is that of /N with the short name inserted
              before the long name. If no short name is present, blanks are
              displayed in its place.

So, doing a dir /X command on C:\ displays the following:

C:\>dir /X
 Volume in drive C is OSDisk
 Volume Serial Number is XXXX-XXXX

 Directory of C:\

...
08/17/2017  08:02 PM    <DIR>          PROGRA~1     Program Files
08/09/2017  03:58 PM    <DIR>          PROGRA~2     Program Files (x86)
...

You can use the directory short name PROGRA~2 to substitute Program Files (x86), and have the following settings in your settings.json for VS Code:

{
    "terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\cmd.exe",
    "terminal.integrated.shellArgs.windows": [
        "/k C:\\PROGRA~2\\Cmder\\vendor\\init.bat"
    ]
}

Which does load Cmder successfully in the integrated terminal:

Image of Cmder being successfully loaded in the VS Code integrated terminal.


This is the new method to do that '2021'

related to this article

Step 1: Download Cmder.

Step 2: Save Cmder to C:\ drive

Step 3: Open Settings.json in VSCode (File - Preferences - Settings ...)

Step 4: Enter this parameters:

"terminal.integrated.profiles.windows": {
    "Cmder": {
      "path": "${env:windir}\\System32\\cmd.exe",
      "args": ["/k", "C:\\cmder\\vendor\\bin\\vscode_init.cmd"]
    }
  },
  "terminal.integrated.defaultProfile.windows": "Cmder",