How can I send a notification to a Windows 10 computer from the command line
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.
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.
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.
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
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:
- Register for an account and log in
- Download and install Pullover
- Login to Pullover and give your computer a device name
- You should receive a "Welcome to Pushover!" notification confirming that notifications are working
- Note down your User Key displayed on your account page
- Scroll down, and click Register an Application/Create an API Token
- Enter a
Name
, and selectScript
as theType
- Accept the T&Cs, and click
Create Application
- Note down the API Token/Key you are given
- Download curl and stick it somewhere in your
%PATH%
- Open a Command Prompt
-
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
andapi-token
are the User Key and API Token/Key you recorded earlier,notification-title
is the title of the notification andnotification-text
is the text - 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)