VS Code 终端 Shell 集成 (Windows)
发布: (2025年12月30日 GMT+8 08:19)
1 min read
原文: Dev.to
Source: Dev.to
Problem
VS Code 可能会在未启用终端 Shell 集成或使用不受支持的 Shell 时显示 “The terminal is awaiting input” 以及类似提示。
Required VS Code Settings
在 settings.json 中添加以下内容:
{
"terminal.integrated.shellIntegration.enabled": true,
"terminal.integrated.defaultProfile.windows": "PowerShell 7",
"terminal.integrated.profiles.windows": {
"PowerShell 7": {
"path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe"
}
}
}
After Changing Settings
- 关闭所有终端。
- 重新加载 VS Code 窗口。
如果提示仍然出现,说明你仍在使用 Windows PowerShell 5.1,其 Shell 集成不够可靠。
Fix (One‑time per Machine)
安装 PowerShell 7,它完整支持 VS Code 终端集成并解决命令/输入检测问题。
- Microsoft Docs: https://learn.microsoft.com/powershell/scripting/install/installing-powershell-core-on-windows
- 或通过 winget 安装:
winget install Microsoft.PowerShell