Search code examples
windows-7cmdnotifyballoon

call notify balloon message in windows 7 from cmd?


I need to create a notification balloon message in Windows 7 from the Command prompt with custom text. I have searched Google and found shell32.


Solution

  • This can be done in Powershell:

    throw an icon (.ico file) in a c:\temp directory or point that somewhere else.

    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    
    $objBalloon = New-Object System.Windows.Forms.NotifyIcon
    $objBalloon.Icon = "C:\temp\Folder.ico"
    
    # You can use the value Info, Warning, Error
    $objBalloon.BalloonTipIcon = "Info"
    
    # Put what you want to say here for the Start of the process
    $objBalloon.BalloonTipTitle = "Begin Title"
    $objBalloon.BalloonTipText = "Begin Message"
    $objBalloon.Visible = $True
    $objBalloon.ShowBalloonTip(10000)                       
    

    Do some work

    Put what you want to say here for the completion of the process

    $objBalloon.BalloonTipTitle = "End Title"
    $objBalloon.BalloonTipText = "End Message"
    $objBalloon.Visible = $True
    $objBalloon.ShowBalloonTip(10000)