Use cmder as default shell in VSCode

1.7k Views Asked by At

Every other solution I can find to this question says to put the settings below inside my.vscode/settings.json

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
 "terminal.integrated.shellArgs.windows": [
     "/K",
     "C:\\softwares\\cmder\\vendor\\init.bat"
], 

This worked until recently, when I removed my settings file from a git repo. Now when I hover over the code above, I get this text in a popup

The path of the shell that the terminal uses on Windows (default: C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe). Read more about configuring the shell. This is deprecated, use #terminal.integrated.defaultProfile.windows# instead(2)

This is a bit confusing to me, I'm not sure what I have to change to what. I tried changing the first setting to

"terminal.integrated.defaultProfile.windows": "C:\\WINDOWS\\System32\\cmd.exe",

But this has had no effect. Cmder is not being used as the default shell.

3

There are 3 best solutions below

2
On

try add follow config in settings.json

"terminal.integrated.automationShell.windows": "C:\\WINDOWS\\System32\\cmd.exe",

A path that when set will override terminal.integrated.shell.windows and ignore shellArgs values for automation-related terminal usage like tasks and debug.

1
On

cmder comes as an executable program. You do not need to use a batch script to open it. Just firing the exe starts the program.

(from the official download page:)

  1. Unzip
  2. (optional) Place your own executable files into the bin folder to be injected into your PATH.
  3. Run Cmder (Cmder.exe)

Therefore, you just need to add a single line to settings.json:

"terminal.integrated.shell.windows": "C:\\full\\path\\to\\unzipped\\cmder.exe"

This shouldn't need to take in any flags or commands, args, unless you are wanting to change it's default functionalities (such as changing the default folder that the cursor points to on launch). For default cmder, just run the exe...

2
On

VSCode changed how integrated terminal profiles are handled in April 2021. Based on the args you provided in your question, adding this to your settings.json should work:

    "terminal.integrated.profiles.windows": {

        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [
                "/K",
                "C:\\softwares\\cmder\\vendor\\init.bat"
            ], 
            "icon": "terminal-cmd"
        }
    },
    "terminal.integrated.defaultProfile.windows": "Command Prompt"