SuperAPI AI Directory

windows-terminal

Deployment & operations

View repository

Updated 10-16 09:31

About this skill

Windows Terminal Management

Through the wt command line, operate Windows Terminal: open new tabs, select profiles, split panes, and manage sessions. Built into Windows 11; on Windows 10 it can be installed via the Microsoft Store.

Use Cases

  • The user says "open a terminal," "open a PowerShell window," "open a WSL terminal"
  • Need to run multiple commands simultaneously (split-pane operations)
  • Need to open a terminal with a specific profile
  • Long-running tasks require a standalone terminal window

Command Reference

Open a new terminal

# 打开默认终端
wt
Open PowerShell

wt -p "PowerShell"

Open CMD

wt -p "Command Prompt"

Open WSL (if installed)

wt -p "Ubuntu"


### 指定工作目录

```powershell
# 在指定目录打开
wt -d "C:\Users\%USERNAME%\Projects"

# 在当前目录打开新终端
wt -d .

Run a command

# 打开并执行命令
wt -- powershell -NoExit -Command "Get-Process | Sort-Object CPU -Descending | Select-Object -First 10"

# 打开 CMD 并执行
wt -p "命令提示符" -- cmd /k "dir C:\"

# 打开并运行 Python 脚本
wt -- python "C:\scripts\monitor.py"

Tab Management

# 打开多个标签页
wt -p "PowerShell" `; new-tab -p "命令提示符" `; new-tab -p "Ubuntu"

# 带标题的标签页
wt --title "前端开发" -d "C:\project\frontend" `; new-tab --title "后端" -d "C:\project\backend"

Split Pane

# 水平分屏
wt -p "PowerShell" `; split-pane -H -p "命令提示符"

# 垂直分屏
wt -p "PowerShell" `; split-pane -V -p "命令提示符"

# 指定分屏比例
wt -p "PowerShell" `; split-pane -V --size 0.3 -p "命令提示符"

# 复杂布局:左右分屏 + 右侧再上下分
wt -p "PowerShell" `; split-pane -V -p "命令提示符" `; split-pane -H -p "Ubuntu"

Window Control

# 全屏启动
wt --fullscreen

# 最大化启动
wt --maximized

# 指定窗口大小和位置
wt --pos 100,100 --size 120,40

# 聚焦到指定标签
wt focus-tab -t 0

Configuration Management

# 打开设置界面
wt settings

# 列出已有配置文件
Get-Content "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" |
    ConvertFrom-Json |
    Select-Object -ExpandProperty profiles |
    Select-Object -ExpandProperty list |
    ForEach-Object { Write-Output "$($_.name) — $($_.commandline)" }

Common Development Scenarios

Frontend and Backend Development Environment

# 一键开启开发环境:前端 + 后端 + 数据库日志
wt --title "Frontend" -d "C:\project\frontend" -- npm run dev `; `
   new-tab --title "Backend" -d "C:\project\backend" -- python main.py `; `
   new-tab --title "Logs" -- powershell -Command "Get-Content C:\logs\app.log -Wait"

System Monitoring

# 分屏监控:进程 + 网络 + 磁盘
wt -- powershell -NoExit -Command "while(1){cls;Get-Process|Sort CPU -Desc|Select -First 10;sleep 3}" `; `
   split-pane -V -- powershell -NoExit -Command "while(1){cls;Get-NetTCPConnection|Group State|Sort Count -Desc;sleep 5}"

Output Specifications

  • After opening the terminal, inform the user "Opened in a new window/tab"
  • For split-pane operations, explain the purpose of each area
  • For the profile list, display the name and the corresponding Shell

Security Rules

  • Do not launch the terminal as administrator(unless the user explicitly requests it)
  • For long-running commands, use -NoExit to prevent the window from closing automatically
  • When commands include paths, ensure the paths exist