SuperAPI AI Directory

windows-notification

General & other

View repository

Updated 10-16 00:04

About this skill

Windows System Notification

Send Windows 10/11 system notifications using PowerShell.

Use Cases

  • Notify the user after a long-running task is complete
  • Scheduled reminders
  • Important messages that need to attract the user's attention

Command Reference

Method 1: BurntToast module (recommended, feature-rich)

# 首次安装
Install-Module -Name BurntToast -Force
Basic notification

New-BurntToastNotification -Text "小搭子", "任务已完成"

Notification with a button

$button = New-BTButton -Content "查看" -Arguments "explorer.exe" New-BurntToastNotification -Text "小搭子", "文件整理完毕" -Button $button


### 方式 2:.NET 原生(无需安装,兼容性好)

```powershell
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom, ContentType = WindowsRuntime] | Out-Null

$template = @"
<toast>
  <visual>
    <binding template="ToastGeneric">
      <text>小搭子</text>
      <text>任务已完成</text>
    </binding>
  </visual>
</toast>
"@

$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$xml.LoadXml($template)
$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("小搭子").Show($toast)

Method 3: msg command (simplest, pop-up style)

msg * "任务已完成 — 小搭子"

Usage Guidelines

  • Notification titles are uniformly "小搭子"
  • Send only when a task taking > 10 seconds is complete, on error warnings, or when a scheduled task is triggered
  • At most 1 completion notification per task