voici le code:
Code : Tout sélectionner
dim $os
$os=@OSVersion
switch $os
;partie pour windows XP
case "WIN_XP"
run ("defrag.exe c: -v") ;c:\WINDOWS\system32\defrag.exe
winwaitactive("C:\WINDOWS\system32\defrag.exe")
msgbox(0,"","defragmentation en cours",0)
$i=1
While $i=1
$i=WinExists("C:\WINDOWS\system32\defrag.exe")
WEnd
msgbox(0,"","defragmentation terminer",0)
;partie pour windows 2000
case "WIN_2000"
;partie pour windows 98
case "WIN_98"
;run ("defrag.exe c: -v")
;winwaitactive("Défragmentation du lecteur C")
;msgbox(0,"","defragmentation en cours",0)
;$i=1
;While $i=1
;$i=WinExists("Défragmentation du lecteur C")
;WEnd
;msgbox(0,"","defragmentation terminer",0)
EndSwitch
msgbox(0,"",$os,0)