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通知時,它會被執行。 。

警告:你可以看到,有一些>」模塊需要他們的工作,所以不要忘記他們

相關問題