Visual Studio Code终端无法启动。

23

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

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

请参考此链接以获取完整的错误描述,我编写了代码并编译,出现了错误信息。 链接


你是从哪里编译的?从 VS Code 终端还是你系统的终端? - Maghil vannan
@vinod提供了相关的代码。 - mr. abhi
“march long 2020”文件夹是否存在? - Maghil vannan
@Maghilvannan,我认为是我不小心删除了,但现在我已经重新创建了。 - mr. abhi
@Maghilvannan 不,它没有起作用。 - mr. abhi
显示剩余6条评论
15个回答

0

0

前往 Visual Studio Code 的设置,禁用 powershell.integratedConsole.suppressStartupBanner 属性。这对我有用。我正在使用 VS Code 版本 1.62.3。 在此输入图片描述


0
如果有人遇到“分割终端”无法启动终端的问题,出现错误信息为“终端进程启动失败:启动目录(cwd)”。

enter image description here

通过将 Terminal › Integrated: Split Cwdterminal.integrated.splitCwd 更改为 initialworkspaceRoot,它对我有效。

导致错误的原因可能是您选择的 shell 给出的 路径位置。我在 Windows 上使用 Git Bash 和 Oh My ZSH,在设置 ZSH 后出现了这个错误。


0
问题:
打开VS Code终端时,我遇到了以下错误:
"
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.
"

enter image description here

错误原因:
以下是错误的原因,其中Integrated>Default Profile: WindowsNULL(应该是命令提示符)。

enter image description here

解决方案:

在VS Code中,点击设置-->功能-->终端-->集成>默认配置文件:Windows ---选择命令提示符作为默认配置

将集成>默认配置文件:Windows ---从更改为命令提示符作为默认配置

enter image description here

现在重新启动Visual Studio并再次打开终端。

-1

为什么Visual Studio Code终端启动失败?

Visual Studio Code终端在启动时可能会失败,这是因为默认终端通过程序属性以管理员身份自动启动(请检查下面的超链接图像):

右键单击PowerShell → 属性 → 兼容性 → "以管理员身份运行此程序"

如何解决?

如果您已经选中了此选项,只需取消选中,应用并接受即可。

请记住,在此操作后,将来每次打开终端时,它将不再自动以管理员身份打开。您需要手动右键单击程序,并选择"以管理员身份运行"选项。


1
尽管这个回答的形式很奇怪,但它很可能不是抄袭的,无论是来自ChatGPT还是其他途径。 - Peter Mortensen

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接