I would like to integrate Cmder shell into my VS Code configuration.
I'm using VS Code 64bit on Windows, and I tried to modify my settings.json
file as follows, to make Cmder work as the integrated terminal:
"terminal.integrated.shell.windows": "C:\\Program Files\\Cmder\\Cmder.exe",
I restarted my VS Code and tried to open the terminal.
At first, this error message box showed up:
Failed to copy ConEmu.xml file to backup location!
Restart Cmder as administrator.
So, I launched VS Code as administrator, which made the error message disappear; however, I noticed that VS Code opens Cmder in another separate window instead of in the terminal.
How can I run Cmder shell inside VS Code terminal?
P.S. Could this note in vs code documentation be the solution?
Tip: The integrated terminal shell is running with the permissions of VS Code. If you need to run a shell command with elevated (administrator) or different permissions, you can use platform utilities such as
runas.exe
within a terminal."
from: https://code.visualstudio.com/docs/editor/integrated-terminal
There is a mistake in your configuration file, the following is not valid:
"terminal.integrated.shell.windows": "C:\\Program Files\\Cmder\\Cmder.exe"
You should not be calling Cmder.exe from the VS Code, instead, you should use init.bat
(from the instructions below) to integrate Cmder in VS Code.
Your issue has been already explained here over the Cmder repository.
Make sure you're on the latest release of Cmder – download latest here
Open the settings.json
configuration file, by pressing Ctrl + , (Control-Comma) to access the preferences, then click on the Edit in settings.json link
VS Code documentation explains the process in this link:
Can I use Cmder's shell with the terminal on Windows?
Yes, to use the Cmder shell in VS Code, you need to add the following settings to your
settings.json
file:"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe", "terminal.integrated.shellArgs.windows": ["/K", "C:\\cmder\\vendor\\init.bat"]
BTW, You need to replace C:\\cmder
with your own installation path.
Tip: replace single backslashes (\
) with double backslashes (\\
).
Make sure you read the notice at the official Cmder wiki:
👉 Please note the use of
cmd.exe
instead ofcmder.exe
.
Tip: refer to here on notes about handling spaces in your path.
TL;DR: It's not recommended by the Cmder team, but you may use ^
character before spaces to handle the paths.
You don't need to restart VS Code to make this work.
Hit Ctrl + ` (Control-Tilde) to open Cmder in VS Code terminal!
You may refer to my answer here for a complete explanation of how this works.
There are similar issues over the VS Code repo and here on Cmder repo as well.