On Windows 11, you can generate a system notification (toast) using PowerShell or Command Prompt (cmd). Here’s how to do it in both:
You can use the New-BurntToastNotification cmdlet from the BurntToast module (requires installation) or use a native approach with Windows.UI.Notifications.
powershellAdd-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing $notify = New-Object System.Windows.Forms.NotifyIcon $notify.Icon = [System.Drawing.SystemIcons]::Information $notify.BalloonTipTitle = "Notification Title" $notify.BalloonTipText = "This is your notification message!" $notify.BalloonTipIcon = "Info" $notify.Visible = $true $notify.ShowBalloonTip(5000) # Shows for 5 seconds Start-Sleep -Seconds 5 $notify.Dispose()
powershellInstall-Module -Name BurntToast -Force
powershellImport-Module BurntToast New-BurntToastNotification -Text "Hello, Benjamin!", "This is a toast notification from PowerShell."
cmd)You can use VBScript or PowerShell from cmd to generate a notification.
cmdecho Set objWSHShell = WScript.CreateObject("WScript.Shell") > temp.vbs echo objWSHShell.Popup "This is a popup notification!", 5, "Notification Title", 64 >> temp.vbs start temp.vbs
cmdcmdpowershell -command "Add-Type -AssemblyName System.Windows.Forms; $notify = New-Object System.Windows.Forms.NotifyIcon; $notify.Icon = [System.Drawing.SystemIcons]::Information; $notify.BalloonTipTitle = 'Notification'; $notify.BalloonTipText = 'Hello from CMD!'; $notify.BalloonTipIcon = 'Info'; $notify.Visible = $true; $notify.ShowBalloonTip(5000); Start-Sleep -Seconds 5; $notify.Dispose()"
cmd.For true toast notifications, use the following PowerShell script (requires Windows 10/11):
powershell[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null $template = @" <toast> <visual> <binding template="ToastText02"> <text id="1">Notification Title</text> <text id="2">This is a native toast notification!</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("Windows PowerShell").Show($toast)
Vibe can make mistakes. Check answers. Learn more