Reputation: 301
I tried to compile a program, but the 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 the same error, but the pop-up is different link.
Below is the JSON file of my Visual Studio Code:
{
"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 an error message.
Upvotes: 28
Views: 152056
Reputation: 169
I had a similar issue while running VS Code with WSL (Windows Subsystem for Linux). I was getting the following error
The terminal process failed to launch: Starting directory (cwd) "/home/username" does not exist.
I resolved it by adding
"terminal.integrated.cwd": "//wsl.localhost/Ubuntu/home/username",
Reload VS Code and try again
You can change the path to any directory you want - the "//wsl.localhost/Ubuntu" prefix is what's important. Change "Ubuntu" to the name of the distribution you are using (in Windows PowerShell, run wsl --list
to see the installed distributions).
Upvotes: 0
Reputation: 10601
This setting breaks my terminal window (because PowerShell is blocked due company administrative policy):
Afterwards, I could not open the terminal again.
Restore CMD as default
terminal.integrated.defaultProfile.windows
and set a default (for me Command Prompt)Now the terminal should open again. This is not a fix to get PowerShell working in Visual Studio Code, just a guide to restore the terminal window.
Upvotes: 56
Reputation: 1303
PROBLEM:
I got following error while opening VS Code terminal:
"
The terminal process failed to launch: Windows cannot open this program because it has been prevented by a software restriction policy.
For more information, open Event Viewer or contact your system Administrator.
"
REASON OF ERROR:
Following is the reason of error where Integrated>Default Profile: Windows is NULL (It should be command prompt)
SOLUTION:
In VS code -->settings-->Features-->Terminal-->Integrated>Default Profile: Windows ---select command prompt as default
Changed Integrated>Default Profile: Windows ---from NULL to command prompt as default
Now Restart visual studio and open terminal again.
Upvotes: 0
Reputation: 331
If anyone having the issue with split terminal failing to launch terminal due to The terminal process failed to launch: Starting directory (cwd)
.
It works for me by changing the Terminal › Integrated: Split Cwd
or terminal.integrated.splitCwd
to initial
or workspaceRoot
.
The error caused might be due to the path location given by your chosen shell. I am using Git Bash on Windows with Oh My ZSH, the error showed up after setting up the ZSH.
Upvotes: 2
Reputation: 748
I had the same issue on my Mac. I solved it by adding
"terminal.integrated.shell.osx": "/bin/bash"
in file settings.json.
Upvotes: 2
Reputation: 1
I really struggled with this issue when creating a new project with Maven and I later realized the issue was with restriction on my profile folder as the machine belongs to the company.
I decided to uninstall Visual Studio Code as by default its usually installed under C:\Users\ProfileName\AppData\Local\Programs\Microsoft VsCode
and re-install it as an administrator. Guide to completely install Visual Studio Code is on page How can I uninstall Visual Studio Code completely?
To install Visual Studio Code as administrator you have to download the System Installer version (NOT the default one with a big blue button). Once downloaded, run it as administrator and the installation will be directed to the programs folders as opposed to the user profile folder...enjoy!
Upvotes: 0
Reputation: 1420
Sometimes in Visual Studio Code, its default profile path of the command prompt will be mismatched so for that reason it is unable to launch the terminal.
Solution 1: try correct it with this path: "terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe".
or
Solution 2:
Press Ctrl + P to open the settings.json file.
Find the line: terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe and update with the 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",
Upvotes: 0
Reputation: 1
If you on Windows, before doing any of those steps, try to perform a Full Shut down or Restart.
Press and hold the Shift key and shut down or restart your PC from the start menu.
It helped to get terminal back many times.
Upvotes: 0
Reputation: 1064
It appears that you're trying to get PowerShell in a Visual Studio Code integrated terminal.
Let me share the process of how I did it.
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.
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"
Upvotes: 7
Reputation: 796
I also faced the same issue, but I was not able to find a solution.I got a different fix for that..
Upvotes: 1
Reputation: 111
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
Upvotes: 0
Reputation: 1286
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.
Upvotes: 0
Reputation: 1
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
Upvotes: 0
Reputation: 325
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.
Upvotes: 3
Reputation: 33
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.
Upvotes: 1