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
Related videos on Youtube
Author by
Matthew Wai
Updated on September 18, 2022Comments
-
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 over 7 yearsYou haven't included
pop-up_message.vbs
:/ -
LotPings over 7 yearsNo cmd/vbscript but powershell can show a notification balloontip works nicely in Win10
-
Matthew Wai over 7 yearsSorry, 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 almost 5 yearswhat is
"D:\folder\NoTrayOrphans.exe"
?? and, should that line be part of the previous line?