Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

custom notification with powershell

$ErrorActionPreference = "Stop"
$notificationTitle = "Notification: Your script has been completed successfully"
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
$toastXml = [xml] $template.GetXml()
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$xml.LoadXml($toastXml.OuterXml)
$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)
$toast.Tag = "Test1"
$toast.Group = "Test2"
$toast.ExpirationTime = [DateTimeOffset]::Now.AddSeconds(5)
$notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("Script Completed!")
$notifier.Show($toast);
Comment

PREVIOUS NEXT
Code Example
Shell :: pip install pathlib 
Shell :: linux move everything in a directory to another directory 
Shell :: fish wsl 
Shell :: create and copy folder in ubuntu 
Shell :: how to run docker in ubuntu 
Shell :: delete non empty directory cmd 
Shell :: dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2 
Shell :: install pytorch in jupyter notebook 
Shell :: grep lines after match 
Shell :: installing pytorch 
Shell :: set up ssh windows 10 
Shell :: open path using terminal ubuntu 
Shell :: start powershell as different user 
Shell :: install vue router 
Shell :: File "manage.py", line 17 ) from exc ^ SyntaxError: invalid syntax 
Shell :: dpkg install force 
Shell :: wsl zsh get ip 
Shell :: linux find all files name containing string 
Shell :: wordpress update core and plugins cli 
Shell :: kubernetes on windows 10 
Shell :: gcloud app deploy 
Shell :: installing sdk manager on ubuntu 
Shell :: ubuntu send input to screen 
Shell :: how to remove remote origin git 
Shell :: bash for loop parallel 
Shell :: ubuntu wifi with no internet 
Shell :: curl send to ip 
Shell :: delete branch github 
Shell :: how to push another account git 
Shell :: pip install osgeo 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =