好的,对于那些与我有同样问题的人,我已经通过点击下拉菜单上的 powershell
并将其更改为 cmd
来解决了。
这件事情发生在我改变了CMD的默认路径后,简单地解决方法如下:
对我来说,我尝试使用 Powershell/CMD/Bash,但是出现了错误/空白终端。我发现输入 echo hello
并按下 CTRL + C
使其出现。因此实际上一切都在运行,我的终端只是空白/出现故障,但确实接受输入。
如果你在使用React时遇到了这个问题,那么可能是因为你使用npm start启动了实时版本。负责处理应用程序实时版本的终端无法用于其他任何事情。
所以,为了继续使用终端,您需要打开一个新的终端来并行使用。只需单击终端面板右上角的加号图标,然后选择“Power Shell”选项即可。这将在不重新启动Visual Studio的情况下打开一个新的终端。
在 Mac 上,使用 Python 时,这个方法对我很有帮助:不要点击“运行代码”选项,而是点击右上角的“运行 Python 文件”。
如果输入 Ctrl+C 可以帮助您摆脱这种冻结状态,那么在 VSCode 1.64(2022年1月)中执行将更容易。
终端可以为您输入答案。
Terminal -- Auto-reply
The terminal is now able to automatically reply when a specific sequences of characters is received.
A good example of where this is useful, which is also the only default case, is the Windows batch script message
Terminate batch job (Y/N)?
after hitting Ctrl+C when running a batch script.
This typically just ends up causing problems for the user.The terminal will now automatically reply with
Y
and enter (\r
) which makes Ctrl+C in Windows feel much better.Pressing Ctrl+C will immediately reply to the question and return to the prompt:
Theme: Sapphire
The feature was made generically so you can setup custom replies for other thing, just be careful when doing this as you are sending text to the process automatically.
For example you could use it to automatically update Oh My Zsh when prompted:
"terminal.integrated.autoReplies": { "[Oh My Zsh] Would you like to check for updates? [Y/n]": "Y\r" }
If you use Clink and enable their similar feature, you can disable it in Clink or in VS Code by setting the reply to null to avoid the two features conflicting with each other:
"terminal.integrated.autoReplies": { "Terminate batch job (Y/N)": null }
打开终端,进入首选项和设置。 勾选“在终端中运行代码”。 重新启动VS。