首页 > 解决方案 > Visual Studio (VS-code) 代码终端无法启动

问题描述

我试图编译一个程序,但终端没有打开。

error:The terminal process failed to launch: Starting directory (cwd) "D:\vs code\march long 2020" does not exist.

这家伙有同样的错误,但弹出是不同的链接

下面是我的 vscode 的 JSON 文件

{
    "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": [
    
    ]
}

请参阅此链接以获取完整的错误描述,我编写代码并编译并收到错误消息。 关联

标签: visual-studio-code

解决方案


此设置破坏了我的终端窗口(因为 powershell 因公司管理员而被阻止): 在此处输入图像描述

之后我无法再次打开终端。

将 CMD 恢复为默认值

更改 VS Code 设置中的路径:

  • 打开首选项 > 设置 (CTRL+,)
  • 搜索terminal.integrated.shell.windows
  • (其他操作系统替换windwoslinuxor osx

在此处输入图像描述

  • 点击Edit in settings.json
  • 设置CMD路径"terminal.integrated.shell.windows": "C:\\windows\\System32\\cmd.exe",

在此处输入图像描述

现在终端应该再次打开。这不是让 Powershell 在 VS Code 中工作的修复程序,只是恢复终端窗口的指南。

2021 年 9 月更新(附加设置)

搜索terminal.integrated.defaultProfile.windows并设置默认值(对我来说命令提示符)

在此处输入图像描述


推荐阅读