How to use a custom command line in place of terminal for VS Code?
I have a custom
cmd.exe shortcut that I use with a modified target to a
shell.bat that calls
vcvarsall.bat so I can run
cl from custom
build.bat files for my projects.
I attempted to change the setting for the default terminal in
custom_shell_cmd.exe runs and will compile code as it should and I have been using it for about a year with no issues.
Visual Studio Code returns with the following error when trying to open a terminal with the path:
The terminal process failed to launch: Path to shell executable "C:\Development\CustomCP\custom_cmd.exe" does not exist.
The setting for "intgrated" vs "external" under Terminal doesn’t change the outcome. When set to external the error persists.
The custom target is:
%windir%\system32\cmd.exe /k "c:\Development\vcvarsallCLshell\shell_VS2019_CE.bat"
So the shortcut calls
cmd.exe like normal, then runs my shell script. Works like a charm. Just won’t work with VS Code Integrated Terminal.
Just in case, here is the shell script:
@echo off rem shell.bat for VS2019 Community install call "\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
Yes, this is possible, but in a round about way.
Visual Studio Code does not accept my custom
cmd.exe from inside the app but since VSCODE is on
code . I can add
code . to my batch file and open Visual Stuio Code in the command prompt instance running
The new file:
@echo off rem shell.bat for VS2019 Community install call "\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 code .
This allows me to stay within the visual studio editor and use ctrl + (back-tick) to open and move to a
cmd.exe that is now running
This allows me to compile without leaving VSCODE and that saves alot of time switching to the open
This also opens the possibility of a custom desktop/taskbar shortcut for vscode. One click to open everything.
I have made the batch files available on github here.
There is also instruction on how to get this to work in the
Answered By – BornGeek