Yva*_*ain 5 terminal powershell visual-studio-code
VS Code(Windows 10)
我想从ps1脚本中实现什么:
我创建了一个Powershell脚本,该脚本从默认打开的终端运行。现在,我想从第一个打开一个新的终端标签。
我可以从终端启动vs代码命令快捷方式(Ctrl +`)或vs代码命令选项板(Ctrl + Shift + P)吗?
这是我解决问题的方法。
我创建了一个VS Code 扩展并使用了扩展 API。
// Create a terminal Window
const term = vscode.window.createTerminal("terminal_name");
// Write any powershell command
term.sendText("cd C:\\path\\to\\follow\\");
// Any other command
term.sendText("yarn start");
// Create a second terminal
const secTerm = vscode.window.createTerminal("second_terminal_name");
secTerm.sendText("cd C:\\another\\path\\to\\follow\\");
secTerm.sendText("py manage.py runserver");
// and so one
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
298 次 |
| 最近记录: |