Bonjour,
est-il possible de lancer une notification (toaster) dans Windows 10 avec un simple script batch ?
merci
Version imprimable
Bonjour,
est-il possible de lancer une notification (toaster) dans Windows 10 avec un simple script batch ?
merci
Salut,
Voici un code BAT/Powershell qui peut t'intèresser :
::Tooltip Balloon
::By SachaDee - 2016
Afficher des tooltip depuis vos BAT
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13 ::Tooltib Balloon ::By SachaDee - 2016 @echo off set "$Titre=Message" Set "$Message=Salut pol2095" ::Pour L'icone valeur possible Information, error, warning, 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$=)
;)
impec, merci
une autre question, comment ajouter un retour chariot dans le message ?
La réponse rapide !
;)Code:"$Message=Salut pol2095 Ligne 2"
d'accord juste des espaces, pas de caractères spéciaux comme \n
J'ai tenté de faire 2 message et de mettre :
"%message1% `n %message2%" dans le code powershell, mais sans succès.
faudrait approfondir...
;)
J'ai trouvé un solution
créer un fichier "BalloonTip.ps1"pour le lancerCode:
1
2
3
4
5
6
7
8
9
10 [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $icon = $args[0] $text = $args[2] -split "``n" -join "`n" $objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon $objNotifyIcon.Icon = [System.Drawing.SystemIcons]::$icon $objNotifyIcon.BalloonTipIcon = "None" $objNotifyIcon.BalloonTipText = $text $objNotifyIcon.BalloonTipTitle = $args[1] $objNotifyIcon.Visible = $True $objNotifyIcon.ShowBalloonTip(10000)
Code:powershell -executionpolicy bypass -file ".\BalloonTip.ps1" Information Message "Salut`npol2095"