美文网首页
Powershell 发送Windows通知

Powershell 发送Windows通知

作者: 大飞哥 | 来源:发表于2020-02-20 15:37 被阅读0次

push_notification.ps1


Add-Type -AssemblyName System.Windows.Forms 

$global:balloon = New-Object System.Windows.Forms.NotifyIcon
$balloon.Icon = "C:\PowerShellScript\Icon\Checked.ico" 
$balloon.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Info 
$balloon.BalloonTipText = 'What do you think of this balloon tip?'
$balloon.BalloonTipTitle = "Attention $Env:USERNAME" 
$balloon.Visible = $true 
$balloon.ShowBalloonTip(10)

balloon.BalloonTipIcon 有4个值,ToolTipIcon Enum
)

如果需要展示中文,那么需要将脚本保存为gbk编码

当然还有更方便的,安装BurntToast
库,一切就都很方便。

相关文章

网友评论

      本文标题:Powershell 发送Windows通知

      本文链接:https://www.haomeiwen.com/subject/supxqhtx.html