'Visual Studio (VS-code) code terminal is failing to launch
I tried to compile a program but terminal is not opening.
error:The terminal process failed to launch: Starting directory (cwd) "D:\vs code\march long 2020" does not exist.
this guy has same error but pop-up is different link
below is the JSON file of my vscode
{
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"C_Cpp.updateChannel": "Insiders",
"files.autoSave": "afterDelay",
"java.saveActions.organizeImports": true,
"window.zoomLevel": 0,
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"terminal.integrated.windowsEnableConpty": false,
"json.schemas": [
]
}
see this link for full error description, i wrote code and compiled and got error message. link
Solution 1:[1]
This setting breaks my terminal window (because powershell is blocked due company admin):

Afterwards I could not open the terminal again.
Restore CMD as default
Change the path in the VS Code settings:
- open Preferences > Settings (CTRL+,)
- search for
terminal.integrated.shell.windows - (other OS replace
windwoswithlinuxorosx)
- click
Edit in settings.json - set CMD path
"terminal.integrated.shell.windows": "C:\\windows\\System32\\cmd.exe",
Now the terminal should open again. This is not a fix to get Powershell working in VS Code, just a guide to restore the terminal window.
UPDATE Sep 2021 (Additional Setting)
Search for terminal.integrated.defaultProfile.windows and set a default (for me Command Prompt)
Solution 2:[2]
It appears that you're trying to get Powershell on VS Code integrated terminal.
Lemme share the process of how I did it.
- Open VS-Code
- Go to File > Preferences > Settings
- Type "Terminal" in the search bar
- Under features > click on "terminal"
- Scroll down until you find a section like this and make sure the option is empty (this sets a default starting directory):
Terminal › Integrated: Cwd An explicit start path where the terminal will be launched, this is used as the current working directory (cwd) for the shell process. This may be particularly useful in workspace settings if the root directory is not a convenient cwd.
- Scroll down until you find this other option
Terminal › Integrated › Shell: Windows The path of the shell that the terminal uses on Windows (default:
Click on edit settings.json
Paste your terminal absolute path within the brackets (make sure you escape the slashes) that's the reason of why I'm using double
"terminal.integrated.shell.windows": "C:\\InstallationDirectory\\PowerShell\\7\\pwsh.exe"
Enjoy
Solution 3:[3]
I also faced the same issue but i was not able to find a solution.I got a different fix for that..
- Install git bash.... link (https://git-scm.com/downloads).
- Open the settings.json file. change the path of terminal to where u installed git-bash.
i.e in "terminal.integrated.shell.windows":
eg:- "terminal.integrated.shell.windows": "C:\Program Files\Git\git-bash.exe" in my case. NOTE:- the path contains double back slash(\ \). - press ctrl+`. external Terminal opens on current directory.
- now compile your code :)
Solution 4:[4]
FYI I faced the same issue when I named my parent directory in 3byte characters. Changed the directory name to alphabetical to resolve the issue.
Solution 5:[5]
I had the same issue with VS Code running on Windows connecting to a Linux remote. It probably occurred since during my previous session I deleted a directory on the remote and now it was trying to start a shell in this directory. Simply recreating the directory (an empty one) solved the problem for me.
Solution 6:[6]
Had same issue on my mac. Solved it by adding
"terminal.integrated.shell.osx": "/bin/bash"
in settings.json
Solution 7:[7]
If you on windows, before doing any of those steps Try to perform a Full Shut down or Restart.
Press and hold shift key and shut down or restart your pc from the start line.
Helped to get terminal back many times.
Solution 8:[8]
I was getting this error "The terminal process failed to launch: Path to shell executable "C:\Program Files\PowerShell\7\pwsh.exe" does not exist" What i noticed i have not installed powershell 7 as i have installed this error has been resolved
or if we want to continue with same Powershell what we have on our system then we have to change the path By editing the jason file setting>terminal.integrated.shell.windows>Edit in setting.jason enter image description here
comment out "terminal.integrated.shell.windows": "C:\Program Files\PowerShell\7\pwsh.exe", and uncomment "terminal.integrated.shell.windows": "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe", enter image description here
Solution 9:[9]
I was able to fix this by adding "type": "shell" to the task. It seems that the default is "type": "process" and that wasn't letting the task run. The process type would need the windows/command structure as outlined here: https://code.visualstudio.com/docs/editor/tasks#_operating-system-specific-properties.
Solution 10:[10]
Go to the setting of Visual Studio Code and disable this property powershell.integratedConsole.suppressStartupBanner. It worked for me.I am using VS code version 1.62.3

Solution 11:[11]
Some times in VS CODE it's default profile path of command prompt will be mismatched so that reason unable to launch terminal.
solution 1: try correct it this path: "terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe".
or
Solution 2:
press ctrl+p to open setting.json file,
find the line :terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe and update with below configuration,
"terminal.integrated.profiles.windows": {
"my-pwsh": {
"source": "PowerShell",
"args": ["-NoProfile"]
}
},
//"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"terminal.integrated.defaultProfile.windows": "Command Prompt",
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow



