[笔记] vs code 设置终端

本文详细介绍如何在VSCode中自定义终端设置,包括通过修改settings.json文件来配置cmd、cmder和powershell等不同类型的终端,以及使用Shelllauncher插件实现多终端快速切换的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

设置文件:
setting.json

1 设置自定义终端

cmd

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",

cmder

    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "terminal.integrated.env.windows": {"CMDER_ROOT": "D:\\GreenTools\\cmder"},
    "terminal.integrated.shellArgs.windows": ["/k", "D:\\GreenTools\\cmder\\vendor\\init.bat"],

其中,D:\GreenTools\cmder 为 cmder 的自定义安装目录。

powershell

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",

2 使用插件实现多终端

插件:Shell launcher

Tyriar/vscode-shell-launcher: VS Code extension that enables easy launching of multiple shell configurations in the terminal

在 Files->Preferences->Settings 中,编辑 settings.json 文件。
添加如下配置:

Windows 的配置:

    "shellLauncher.shells.windows": [
        {
            "shell": "C:\\WINDOWS\\System32\\cmd.exe",
            "label": "cmd"
        },
        {
            "shell": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
            "label": "PowerShell"
        },
        {
            "shell": "D:\\Program Files\\Git\\bin\\bash.exe",
            "label": "Git bash"
        },
    ],

以上路径替换为实际电脑上的路径。

设置 vs code 的快捷键,删除原来的 Ctrl + Shift + `` 对应的打开终端方式,将 shellLauncher.launch 映射到此快捷键上。

662394-20190930142432328-1696986732.png

最终效果:
在按下快捷键 Ctrl + Shift + `` 时,会弹出菜单,让你选择需要打开的终端类型。

662394-20190930142533724-1114356923.png


原文链接:
https://www.cnblogs.com/jasongrass/p/11608822.html

转载于:https://www.cnblogs.com/jasongrass/p/11608822.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值