【发布时间】:2020-02-26 15:04:20
【问题描述】:
this question 的答案解决了我的问题的第一部分。
不幸的是,当我安排一个隐藏 powershell 窗口的作业时,我的脚本发送的任何 toast 通知都不会显示。 该脚本使用此脚本 (source) 显示 toast 通知:
Add-Type -AssemblyName System.Windows.Forms
$global:balloon = New-Object System.Windows.Forms.NotifyIcon
$path = (Get-Process -id $pid).Path
$balloon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)
$balloon.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Warning
$balloon.BalloonTipText = 'What do you think of this balloon tip?'
$balloon.BalloonTipTitle = "Attention $Env:USERNAME"
$balloon.Visible = $true
$balloon.ShowBalloonTip(5000)
当我以不隐藏的方式安排 powershell 脚本时,会显示通知,但每次触发脚本时,我都会短暂地看到一个 powershell 窗口。
如何安排隐藏 powershell 窗口但显示 toast 通知的任务或作业?
【问题讨论】:
-
这可能包含您要查找的内容:stackoverflow.com/questions/46808635/…
标签: powershell push-notification scheduled-tasks job-scheduling