如何将我的 VS Code 终端更改为 cmd.exe 而不是 powershell?

How do I change my VS Code terminal to cmd.exe instead of powershell?

出于某种原因,我的 VS Code 终端是 Powershell 而不是 cmd.exe。在我的终端 > 外部:Windows Exec 设置为 C:\WINDOWS\System32\cmd.exe。但是,当我在 VS Code 中打开终端时,我看到 PS C:...>。另外,在终端下拉菜单中,我只看到 powershell 作为一个选项。

如何将终端切换到 CMD.exe?或者,也许我更好的选择是将 cmd.exe 添加到可用终端列表,以便我可以在它们之间切换?

  1. 打开文件 -> 首选项 -> 设置
  2. Select 右上角的用户设置。
  3. 添加以下行

    "terminal.integrated.shell.windows": "cmd.exe"
    

    来源:https://blog.jongallant.com/2017/02/vs-code-integrated-terminal-powershell-default-change-to-cmd/

您可以使用 View / Command Palete / Terminal:select 默认终端到检测到的终端范围内的 select。我的显示 PS 和 cmd.exe 必须更改,因为 PS 在我们的环境中作为安全策略被禁用。

到版本

第一步:

第二步:select所需选项:

"terminal.integrated.defaultProfile.windows": "Command Prompt"

在最近的 VS Code 升级中,配置文件配置中的命令提示符路径也进行了更新 - terminal.integrated.profiles.windows

本文提到了如何重置它。

https://dev.to/andrewriveradev/how-to-set-git-bash-as-integrated-terminal-in-vscode-2k31

  1. 打开命令面板(CMD + Shift + P)
  2. 搜索“首选项:打开用户设置 (JSON)”
  3. 从配置中删除 terminal.integrated.profiles.windows 对象
  4. 通过键入“”(双引号键)创建一个新字段。在引号内键入“终端”。将出现一个选项列表。
  5. Selectterminal.integrated.profiles.windows。当你 select terminal.integrated.profiles.windows 它会被展开
  6. 添加或替换“terminal.integrated.shell.windows”:“cmd.exe”