VSCode配置 关于丢失VSCode默认启动终端一事

在配置前端开发环境的时候碰到一个VSCode 的配置问题,在VSCode 中启用项目的时候,发现默认终端(PowerShell)是空的

项目无法启动,这时候需要自己选择终端

git Bash :自己安装
Command Prompt: cmd 命令提示符
JavaScript Debug Terminal:debug 工具,需要PowerShell 才能使用

每次打开VSCode 启动项目每次都需要手动选择终端,我是一个懒人,这对我一点都不友好,必须设置VSCode 默认启动终端(找回VSCode的默认终端PowerShell)

1.打开VSCode设置
2.点击红色选框(将设置转为json)

3.查看你的终端配置,是否有 PowerShell 终端配置,如果有请看5,如果没有请看4

4.如果没有 PowerShell 终端,请参考复制下面代码(按需复制)

"terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell"
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    },
    "Git Bash": {
      "source": "Git Bash"
    }
  },

5.配置默认启动终端 为 PowerShell 或 Windows PowerShell

"terminal.integrated.defaultProfile.windows": "Windows PowerShell",
1
重启VSCode 发现有了默认启动终端 PowerShell

如果没有,请设置你的PowerShell 权限
1.搜索powershell,以管理员身份运行。

2.输入set-ExecutionPolicy RemoteSigned

3.把权限改权限为A,然后通过 get-ExecutionPolicy 查看当前的状态:

重启VSCode 发现有了默认启动终端 PowerShell

posted @ 2023-01-28 08:57  SultanST  阅读(360)  评论(0编辑  收藏  举报