How To Change Visual Studio Code's Default Shell to Cmder

Visual Studio Code's default Shell in Windows is PowerShell


There are better alternatives to PowerShell or cmd.exe in Windows. My favourite is Cmder.

Presumably you already have Cmder installed in your system, in a path without space, for example C:\Tools\Cmder. Chocolatey's Cmder installation works perfectly fine. 

Change Default Shell

To change Visual Studio Code's default shell, go to Preferences and edit settings.json. Add the following lines, changing the path where Cmder is installed


"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.env.windows": {
"CMDER_ROOT": "C:\\tools\\Cmder"
},
"terminal.integrated.shellArgs.windows": [
"/k C:\\tools\\Cmder\\vendor\\init.bat"
],

Important: you need to set cmd.exe. Setting Cmder.exe will not work

Now you can have all the goodness of Cmder within vscode, such as built-in git integration.


PowerShell in Cmder

You can also change your default shell from the cmd.exe/bash default to PowerShell within Cmder. Use the following settings.json in vscode

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"terminal.integrated.env.windows": {
"CMDER_ROOT": "C:\\tools\\Cmder"
},
"terminal.integrated.shellArgs.windows": [
"-ExecutionPolicy", "Bypass",
"-NoLogo", "-NoProfile", "-NoExit",
"-Command", ". 'C:\\tools\\cmder\\vendor\\conemu-maximus5\\\\..\\\\profile.ps1'"
],






No comments:

Post a Comment