How to display Windows 8 toast notifications from your own scripts
Scripts and batch files are great for automating complex tasks, but they’re not so good at keeping you informed about their progress. Typically you’re forced to Alt+Tab back to the command prompt window to try and figure out what’s going on.
ToastNotification is a tiny console tool which offers an alternative, at least for Windows 8 users. It allows you to display toast notifications -- pop-up status messages which disappear after a few seconds -- from your own scripts.
The program is a tiny download, which contains a single executable (L2ToastNotification.exe), an image which you can replace to customize the look of your notification, and a text file (Toast.txt) with instructions.
Using ToastNotification is as easy as passing it three arguments, each enclosed in quotes: a title, line 1 and line 2.
L2ToastNotification "Pay attention!" "Free space running short on" "Drive D: !!!"
We noticed a problem with validation -- like, there isn’t any -- as ToastNotification crashes if you don’t pass it three arguments. But that’s not a problem when you know, and using an empty string "" works fine.
Each argument can only display a maximum of about 27 characters, so choose carefully.
ToastNotification also displays the 90×90 image ToastNotification.png in your alert. The default image contains the developer’s logo, but you can either delete this to leave a blank space, or replace it with a logo or some other image of your own.
The program worked just fine for us, but if you need an alert which runs on more than just Windows 8 -- and doesn’t require third-party software -- then try something like this:
msg UserName /Time:7 Alert Message Goes Here!
This displays your message to the named user (or * for all), and disappears after the specified number of seconds, or you can drop the /Time switch entirely to wait for a user acknowledgment. It’s not as pretty, and only displays on the desktop, but may be better in some situations.