gpt4 book ai didi

windows - windows 的 "notify-send"等效项是什么?

转载 作者:行者123 更新时间:2023-12-03 11:07:28 28 4
gpt4 key购买 nike

我想为 windows 8.1/windows 10 中的重复通知编写一个 .bat 脚本。
windows 8.1/windows 10 (cmd) 中是否有类似 linux 中的“notify-send”的命令?

最佳答案

编辑
由于 Windows 更新,此模块现已过时且无法正常工作。在此转换中提出了一个工作代码:https://stackoverflow.com/a/51079409/8522619

我制作了一个“模块”,您可以将其添加到 .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 通知。
警告:如您所见,有一些 > "。模块需要它们才能工作,所以不要忘记它们。

关于windows - windows 的 "notify-send"等效项是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39535937/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com