How can I use a bat/vbs file to pop up a message just above the notification area?

7,385

By googling, I found the following way to display a balloon tip:

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon 
$objNotifyIcon.Icon = "D:\folder\image.ico"
$objNotifyIcon.BalloonTipIcon = "None" 
$objNotifyIcon.BalloonTipText = "The CPU is hot!" 
$objNotifyIcon.BalloonTipTitle = "Warning"
$objNotifyIcon.Visible = $True 
$objNotifyIcon.ShowBalloonTip(10000)

Save the above in a .ps1 file and use the following in a .bat file to run the .ps1 file.

powershell -executionpolicy bypass -file "D:\folder\BalloonTip.ps1"
PING -n 10 LOCALHOST
"D:\folder\NoTrayOrphans.exe"

The .bat file can be run without a command window via the following code in a .vbs file:

Set WshShell = CreateObject("WScript.Shell") 
WshShell.Run chr(34) & "D:\folder\BalloonTip.bat" & Chr(34), 0
Set WshShell = Nothing
Share:
7,385

Related videos on Youtube

Matthew Wai
Author by

Matthew Wai

Updated on September 18, 2022

Comments

  • Matthew Wai
    Matthew Wai over 1 year
    CreateObject("WScript.Shell").PopUp "The CPU is hot.", 5
    

    The above is used in a vbs file. The message box will appear in the center of the screen.
    Is it possible to make it appear just above the notification area?

    • DavidPostill
      DavidPostill over 7 years
      You haven't included pop-up_message.vbs :/
    • LotPings
      LotPings over 7 years
      No cmd/vbscript but powershell can show a notification balloontip works nicely in Win10
    • Matthew Wai
      Matthew Wai over 7 years
      Sorry, I don't understand it. I had saved the codes there into a ps1 file, but no balloontip appeared when I ran the file.
  • ashleedawg
    ashleedawg almost 5 years
    what is "D:\folder\NoTrayOrphans.exe"?? and, should that line be part of the previous line?