Option Explicit Dim WSHShell, MonExe, PIDMonExe Dim DateLancement, CheminExeALancer, MaxDuration CheminExeALancer = "Notepad.exe" 'Version où l'on ne donne que le nom de l'exécutable à lancer CheminExeALancer = "Notepad.exe C:\un fichier.txt" 'Version où l'on précise un argument à l'exe à lancer MaxDuration = 5 'Temps maximal d'exécution en secondes Set WSHShell = CreateObject("WScript.Shell") Set MonExe = WSHShell.Exec(CheminExeALancer) 'Lancement de Notepad PIDMonExe = MonExe.ProcessID DateLancement = Now 'Wscript.echo "PID de l'exe : " & PIDMonExe 'On attend que le programme soit terminé Do While MonExe.Status = 0 WScript.Sleep 1000 'Attente de 1 seconde If DateDiff("s", DateLancement, Now) > MaxDuration Then MonExe.Terminate() Exit Do End If Loop 'Wscript.echo "Exe terminé" Set MonExe = Nothing Set WSHShell = Nothing