繁体   English   中英

VS Code从PowerShell打开新终端

[英]VS Code Open new terminal from powershell

VS代码(Windows 10)

我想从ps1脚本实现的目标:

  • 打开4个终端标签
  • 首先运行python venv然后运行django服务器
  • 第二个运行python venv然后运行django shell
  • 第三次运行反应(纱线开始)
  • git和其他的第四个正常的powershell

我创建了一个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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM