11

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.

David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68
jozi
  • 2,833
  • 6
  • 28
  • 41

4 Answers4

14

Notifu is a free open source Windows program that makes balloons appear in the systray with custom text you specify. You can run it from the command-line, so it's easy to include it in a scheduled task or batch file.

http://www.paralint.com/projects/notifu/download.html#Download

Al S.
  • 361
  • 3
  • 4
9

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)
Weston
  • 2,732
  • 1
  • 28
  • 34
Mohammad Jaber
  • 134
  • 1
  • 8
  • 2
    `'[void]' is not recognized as an internal or external command, operable program or batch file.` `'$objBalloon' is not recognized as an internal or external command, operable program or batch file.` Something's missing here – endolith Oct 29 '11 at 17:15
  • 5
    what language is this? PowerShell? The OP asked about cmd. – thejoshwolfe Jan 29 '13 at 20:26
  • You can use this instead of relying on an ico file $objBalloon.Icon = [System.Drawing.SystemIcons]::Information; – Nande Dec 07 '18 at 04:45
7

Here is a working compressed call to powershell. Every part of it is important, because it needs basic notification icon, and "visible" flag.

powershell [Reflection.Assembly]::LoadWithPartialName("""System.Windows.Forms""");$obj=New-Object Windows.Forms.NotifyIcon;$obj.Icon = [drawing.icon]::ExtractAssociatedIcon($PSHOME + """\powershell.exe""");$obj.Visible = $True;$obj.ShowBalloonTip(100000, """TITLE""","""NOTIFICATION""",2)>nul
Asdf
  • 300
  • 2
  • 9
2

You may use NirCmd by Nir Sofer like this:

NirCmd.exe trayballoon [Title] [Balloon Text] [Icon File] [Timeout] 

This does not seem to work for Windows 10. There you may use Toast.exe, which writes to the message area instead.

Toast.exe  -t "Title text" -m "Message"  -p NotificationImage.png

You have to turn on notifications for Toast.exe in the Windows 10 settings dialog under Settings > Notifications & Actions

Community
  • 1
  • 1