13

Linux 具有notify-send将用户通知发送到桌面管理器的命令。(在许多环境中,这些显示为屏幕角落的弹出窗口,以及低电量警告和其他系统消息。)我在监控和备份脚本中使用它。

Cygwin 似乎没有 lib-notify,那么此命令是否有 Windows 等效项?网络搜索让我找到了有关从 Windows 系统托盘/通知区域运行批处理文件的文章,或者尝试从批处理文件中清理系统托盘,但我还没有找到一种方法来从后台进程中生成不显眼的用户消息。

4

3 回答 3

16

你可以试试notifu。它是一种命令行通知应用程序,因此您可以在 cygwin 中使用它。

用法:notifu /p title /m message

于 2013-05-12T19:09:27.357 回答
7

自 UNIX 中的 wall(1) 命令模仿的 NT3.51 天以来,Windows 就具有此功能。对于 Pre vista,7,8 系统,命令是net send

net send * "Message"

在较新的专业版本上,它是msg.exe

msg "%username%" "Hello World"
msg * "Message"

Samba 甚至支持旧的通知协议:echo "Hello world" | smbclient -NM HomePC

而对于新的 Vista 版本,需要使用PsExec/ winexe。有关更多详细信息,请参阅有关向 Windows 7 发送消息的 Ubuntu:SE 文章

于 2015-09-02T18:44:39.197 回答
2

试试这个(对于 Windows 10+):

https://github.com/Windos/BurntToast

通过 Powershell 安装(以管理员身份)

Install-Module -Name BurntToast
New-BTAppId
Import-Module BurntToast
New-BurntToastNotification

您可以通过在 Cygwin 中运行 Powershell 命令powershell.exe -Command 'New-BurntToastNotification'

于 2017-01-06T07:15:01.480 回答