其它综合

关注公众号 jb51net

关闭
首页 > 网络编程 > 其它综合 > vscode不能打开终端

vscode不能打开终端问题的解决办法

作者:trayvontang

这篇文章主要介绍了vscode不能打开终端问题的解决办法,问题的根源是Windows的安全软件限制了PowerShell的运行,而VSCode默认使用PowerShell作为终端,文中将解决的办法介绍的非常详细,需要的朋友可以参考下

遇到vscode不能打开终端问题,一直以为是安全软件限制问题,也没搜到解决方案,因为影响也不大,就没有管。

最近,要用vscode调试代码,发现不能打开终端,没法玩了,又来看这个问题,终于解决了。

记录下来,希望帮助到遇到同样问题的朋友。

终端进程启动失败: 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。

这的确是因为限制问题,不过是因为powershell本身的限制,因为我直接打开powershell都打不开。

vscode默认使用的终端是powershell,所以打不开终端也就是正常现象了。

只需要打开设置(ctrl+,)搜索终端,找到Windows下的终端配置。

添加默认终端配置:

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

Command Prompt表示的就是cmd终端。

还可以添加终端配置,比如,想用git之类的作为终端,就可以,在这个配置文件中添加:

"terminal.integrated.profiles.windows": {
        "gitBash": {
            "path": "D:\\tool\\Git\\bin\\bash.exe",
            "color": "terminal.ansiYellow"
        },
        "cmd": {
            "path": "C:\\WINDOWS\\System32\\cmd.exe",
            "color": "terminal.ansiRed"
        }
    }

把路径改成自己的可执行程序路径就可以了。

可以选择终端。

接下来接可以愉快的进行调试了:

到此这篇关于vscode不能打开终端问题解决办法的文章就介绍到这了,更多相关vscode不能打开终端内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

您可能感兴趣的文章:
阅读全文