18

I'd like to create/send native Windows notifications from the command-line as part of a few automated tasks that I have set up, both on my local machine and for similar tasks on my home server. Both computers run Windows 10, and are on the same network.

I'm looking to receive the notifications from both computers in the action centre on my main computer.

Is there a command-line tool I can use to accomplish this?

2
  • There might be a better way, but one way would be to use Growl with a plugin that can display them as native notifications/toasts. (Growl can accept notification commands from the command line.)
    – Bob
    Feb 17, 2017 at 7:00
  • Check this link
    – Alex
    Feb 17, 2017 at 7:10

4 Answers 4

12

Another way is the built in MSG.exe command that has been there since Vista. From a command prompt there the following:

msg /server:poseidon daniel "Please contact help desk immediately!"

Server is the name of computer you are sending the message to and daniel is a valid user name of the person using that computer. Fast and simple without any extra downloads.

7
  • 3
    Not available anymore in Windows 10.
    – Michael S.
    Feb 17, 2017 at 13:48
  • 5
    works on my Windows 10 machines - you may have to make a small registry change but the command and it's use is definitely available in Windows 10 Feb 20, 2017 at 11:38
  • 8
    @TomGarrisi Why would you say all of that and not provide an explanation as to what registry change?
    – Mithaldu
    Jul 2, 2017 at 13:28
  • I believe it is this: Open regedit and go here "HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Terminal Server", then set AllowRemoteRPC to 1 (src: cezeo.com/tips-and-tricks/msg-command). Sep 5, 2017 at 19:01
  • 2
    @JamesWilkins note that this also enables all remote access to your computer
    – OrangeDog
    Mar 19, 2018 at 12:30
12

If you want to create a native windows notification (a popup in bottom-right corner and persistant in notification center), you could take the following Powershell snippet as a template.

Taken from https://stackoverflow.com/a/47123275/1043209

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon

$objNotifyIcon.Icon = [System.Drawing.SystemIcons]::Information
$objNotifyIcon.BalloonTipIcon = "Info" 
$objNotifyIcon.BalloonTipText = "wzzup this is a title." 
$objNotifyIcon.BalloonTipTitle = "WHATS UPPP THIS IS A PARAGRAPH!"
$objNotifyIcon.Visible = $True

$objNotifyIcon.ShowBalloonTip(10000)
Start-Sleep 500

It looks like this in notification center.

demo

1
  • 5
    You've reversed your text & title! :D Feb 9, 2020 at 11:42
4

You can use Growl for Windows for this. You'd need growlnotify to send the message and the full application where you receive the notification. As per the comments you will need a plugin for native toast notifications.

On the receiving end, you will also need to enable notifications from other PCs and to set up a password.

enter image description here

We're assuming the system where the full GFW package is installed is 192.168.1.110.

On the sending end growlnotify.com /r:"test1" /a:"test1" /host:192.168.1.110 /pass:test boo registers the application. You need to do this once I prefer the batch varient here cause it has more useful warnings for initial setup. You can switch to the exe file once you know things work.

and something like growlnotify.com /n:"test1" /a:"test1" /host:192.168.1.110 /pass:test /t:title message would work after that to send messages.

For anything else, you can probably refer to the docs and hack together something to fill in the message content.

Tested between two windows 10 systems and it works for me.

If you want to send messages from linux to a GFW or growl for mac instance, you can use gntp-send

3
  • I'd forgotten about Growl - I remember playing with it about 10 years ago when I got my original Windows Home Server. Don't think I ever managed to get it to work reliably - I'll have to have another look Feb 17, 2017 at 7:16
  • I'll edit my answer in a bit. I'm away from any sort of PC till this evening but I have a working instance set up with exactly what you need.
    – Journeyman Geek
    Feb 17, 2017 at 7:18
  • Subsequently discovered Pushover notifications (which I'm already using) can received on the desktop now, so I'm using that for now to keep things simpler (see my answer), but I may start using Growl for any notifications that don't need to get on my phone Feb 20, 2017 at 5:39
2

UPDATE 19/05/2018:

Pullover can no longer create native Windows notifications as of version 1.3.0 (due to fixes to support the Fall Creators Update), so this is now only a partial answer to the question. It's still a viable way to get notifications from/via Pushover, but they won't be native.


Something I've been using for a while for mobile notifications is Pushover, which accepts notifications via an HTTP request and sends them to all (or a selection of) devices registered to your account. I've been using curl to generate and send the necessary HTTP requests. (I know, not very 'Windows'y).

Yesterday I found out Pushover now has official desktop support for its notifications via the browser, and third third-party support from via a desktop client called Pullover which displays any notifications received from Pushover as native Windows notifications. Note that receiving desktop notifications requires a license.

Here are the steps required to send a notification via curl:

  1. Register for an account and log in
  2. Download and install Pullover
  3. Login to Pullover and give your computer a device name
  4. You should receive a "Welcome to Pushover!" notification confirming that notifications are working
  5. Note down your User Key displayed on your account page
  6. Scroll down, and click Register an Application/Create an API Token
  7. Enter a Name, and select Script as the Type
  8. Accept the T&Cs, and click Create Application
  9. Note down the API Token/Key you are given
  10. Download curl and stick it somewhere in your %PATH%
  11. Open a Command Prompt
  12. Enter

    curl --form-string "token=api-token" --form-string "user=user-token" --form-string "message=notification-text" --form-string "title=notification-title" https://api.pushover.net/1/messages.json
    

    where user-token and api-token are the User Key and API Token/Key you recorded earlier, notification-title is the title of the notification and notification-text is the text

  13. You should receive a notification with the title and text you just entered

Things to note:

  • Other supported methods for generating notifications include emailing an account specific email address and web services such as IFTTT
  • Pushover allows 7,500 messages to be sent per application per month for free
  • A maximum of ten devices can be linked to a single user account
  • Device/computer names must be unique, or they will replace an existing device
  • Internet access is required to send/receive notifications, although you will get any notifications which have been sent but not received when internet connectivity is restored (in my experience)
1
  • Firefox browser notifications can be turned into native notifications via the GNotifer extension - I don't know how Chrome's notifications display as it's not my primary browser Feb 20, 2017 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.