我想创建一个使用消息框显示特定事件的闹钟。
使用提供的代码:
[System.Windows.Forms.MessageBox]::Show("Do this task" , "Alert!")
Do
{
$waitMinutes = 1
$startTime = get-date
$endTime = $startTime.addMinutes($waitMinutes)
$timeSpan = new-timespan $startTime $endTime
Start-Sleep $timeSpan.TotalSeconds
# Play System Sound
[system.media.systemsounds]::Exclamation.play()
# Display Message
Show-MessageBox Reminder "Do this task."
}
# Loop until 11pm
Until ($startTime.hour -eq 23)