我有这个power
shell脚本发送一个效果很好的通知,除了它没有保存在通知中心的事实.它超时,消失,但当您单击任务栏右侧的通知按钮时它不存在.有什么我可以添加到我的脚本来实现它吗?谢谢!
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon
$objNotifyIcon.Icon = "icoOnline.ico"
$objNotifyIcon.BalloonTipIcon = "None"
$objNotifyIcon.BalloonTipText = "wzzup this is a title."
$objNotifyIcon.BalloonTipTitle = "WHATS UPPP THIS IS A PARAGRAPH!"
$objNotifyIcon.Visible = $True
$objNotifyIcon.ShowBalloonTip(10000)
最佳答案 您可以使用while条件使其持续使用.但是再次不要让脚本永久保留.相反,您可以为此创建后台作业.
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon
while($True)
{
$objNotifyIcon.Icon = [System.Drawing.SystemIcons]::Information
$objNotifyIcon.BalloonTipIcon = "Info"
$objNotifyIcon.BalloonTipText = "wzzup this is a title."
$objNotifyIcon.BalloonTipTitle = "WHATS UPPP THIS IS A PARAGRAPH!"
$objNotifyIcon.Visible = $True
$objNotifyIcon.ShowBalloonTip(10000)
Start-Sleep 500
}
希望能帮助到你.