【VSCode】启动VSCode时终端自动执行cmd命令,解放双手!

 

 

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

将上面这些复制到最下面,核心是Command Prompt,这段代码意思是自定义Vscode的终端,一共定义了三个名字是"PowerShell"、"Command Prompt"、"Git Bash",其中Command Prompt是以cmd.exe作为终端运行程序,启动这个终端时会自动执行"args"参数的代码即

"/k E:\\gitbat\\autowatch.bat"

这句代码显而易见就是执行了我的一个bat批处理文件,文件内容很简单!执行

tsc -w

是的!这就是我每次都会忘记打tsc -w监听ts变化生成js文件的痛苦,现在能够100%保证绝对会执行监听了,因为自动化了!笑死我到现在才知道有个东西叫setting.json。

进入vscode之后,按ctrl + ~ 就能自动打开默认的终端 Command Prompt 

如果你启动时不是默认为Command Prompt的,那就要设置为它

猜你喜欢

转载自blog.csdn.net/qq_39574690/article/details/126838124
今日推荐