【发布时间】:2018-02-16 21:02:58
【问题描述】:
每当我在 Visual Studio Code 中打开终端时,我都会得到一个 bash shell。我想将 CMD 添加为第二个 shell。为此,我浏览了 VS Code 文档并找到了以下命令:
CTRL+SHIFT+`
但它只会打开第二个 bash shell。是否有在集成终端中打开CMD的快捷方式,而不是在外部控制台中打开?
【问题讨论】:
-
也许this 会有所帮助
每当我在 Visual Studio Code 中打开终端时,我都会得到一个 bash shell。我想将 CMD 添加为第二个 shell。为此,我浏览了 VS Code 文档并找到了以下命令:
CTRL+SHIFT+`
但它只会打开第二个 bash shell。是否有在集成终端中打开CMD的快捷方式,而不是在外部控制台中打开?
【问题讨论】:
【讨论】:
如果您想始终打开 cmd,可以使用设置进行配置。
来自docs:
在 Windows 上正确配置 shell 是找到正确的可执行文件并更新设置的问题。 下面列出了常见的 shell 可执行文件及其默认位置:
// Command Prompt
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
// PowerShell
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-cmd.exe",
"terminal.integrated.shellArgs.windows": [
"--command=usr/bin/bash.exe",
"-l",
"-i"
]
// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
如果您只想偶尔打开 cmd,您可以简单地打开一个新的 bash 终端,然后在其中运行 cmd。
如果您经常同时使用这两种方法,您可能需要使用 this 或 this 之类的扩展程序,以便在启动终端时选择终端。
键绑定:
[{
"key": "ctrl+shift+t",
"command": "shellLauncher.launch"
}]
设置:
{
"shellLauncher.shells.windows": [
{
"shell": "bash",
"args": [],
"label": "bash"
}, {
"shell": "cmd",
"args": [],
"label": "cmd"
}
]
}
【讨论】:
在用户设置中添加此项 注意:粘贴在顶部
{
"terminal.integrated.shell.windows": "cmd.exe"
// other settings...
}
【讨论】:
我不知道为什么其他人还没有提到它,但是这里是在 VSCode 中打开 CMD 的最简单方法。
只需在终端中输入 CMD 并回车即可。
【讨论】:
只需打开终端并输入指向您的 cmd 应用程序的链接,例如 C:\Windows\system32\cmd.exe
【讨论】:
如果你想打开另一个 CMD 终端,从 VS Code 终端或任何其他终端,使用
@start run cmd .
或者当你想继续上面的目录并在那里打开 cmd 时:
cd .. & @start cmd .
【讨论】: