1

我想在Windows 8.1/windows 10中编写一个用于定期通知的.bat脚本。 在linux 8.1中,有没有类似“notify-send”的windows 8.1/windows 10(cmd)命令?什么是Windows的“通知 - 发送”等效物?

+0

有Windows中的'净send'命令 - 不知道是否。它仍然存在... – aschipfl

+0

'msg */server:%computername%“Hello”' – Squashman

+0

msg%username%“hello”将通知作为警报框提供,例如 - 我想要它作为通知。当我们收到一封邮件时,会弹出一个蓝色的东西在右上角 – BloomBlack

回答

0

我已经做了“模块”,你可以在你的.bat文件中加入:

:notif 
::Syntaxe : call :notif "Titre" "Message" 

set type=Information 
set "$Titre=%~1" 
Set "$Message=%~2" 

::You can replace the $Icon value by Information, error, warning and none 
Set "$Icon=Information" 
for /f "delims=" %%a in ('powershell -c "[reflection.assembly]::loadwithpartialname('System.Windows.Forms');[reflection.assembly]::loadwithpartialname('System.Drawing');$notify = new-object system.windows.forms.notifyicon;$notify.icon = [System.Drawing.SystemIcons]::%$Icon%;$notify.visible = $true;$notify.showballoontip(10,'%$Titre%','%$Message%',[system.windows.forms.tooltipicon]::None)"') do (set $=) 

goto:eof 

如何使用

这很简单,易于实现它在你的代码和使用如你所愿。您需要做的第一步是复制和粘贴您可以在.bat文件顶部阅读的代码。

时,会做,你尽可做的唯一的事情是在你的.bat文件来使用这个东西:

call :notif "{The title}" "{The message}" 

而且它会显示一个Windows的8/10通知时,它会被执行。 。

警告:你可以看到,有一些>”模块需要他们的工作,所以不要忘记他们

相关问题