在 VSCode IDE 中打开新的集成终端时自动执行命令 [英] Automatically Execute a command when opening a new Integrated Terminal in VSCode IDE

查看:68
本文介绍了在 VSCode IDE 中打开新的集成终端时自动执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VSCode IDE 可以做到这一点吗?在打开新的集成终端时自动执行诸如运行批处理文件或 powershell 脚本之类的命令?

Can VSCode IDE do this? Execute a command such as running a batch file or powershell script automatically when a new Integrated Terminal is opened?

推荐答案

是的,您可以使用 "terminal.integrated.shellArgs" 设置将参数传递给 shell.例如,当打开一个新的终端实例时,以下将打印 Hello World:

Yes, you can use the "terminal.integrated.shellArgs" setting to pass arguments to the shell. For instance, the following will print Hello World when opening a new Terminal instance:

"terminal.integrated.shellArgs.windows": [
    "-NoExit", "-Command", "Write-Host Hello World"
]

这篇关于在 VSCode IDE 中打开新的集成终端时自动执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆