Jump to content
Sign in to follow this  
ezzetabi

A little Defrag all drives script.

Recommended Posts

WinXP only.

Local $sLog = 'c:\DefragAll-log.txt'


Local $aD, $c, $c2

For $c2 = 1 To 2
   Select
      Case $c2 = 1
         $aD = DriveGetDrive("RAMDISK")
      Case $c2 = 2
         $aD = DriveGetDrive("FIXED")
   EndSelect
      
   If Not @error Then
      For $c = 1 To $aD[0]
         FileWriteLine($sLog, 'Drive ' & $aD[$c] & ' started  : ' & _DateTime())
         RunWait(@ComSpec & ' /c defrag ' & $aD[$c] & ' /f')
         FileWriteLine($sLog, 'Drive ' & $aD[$c] & ' finished : ' & _DateTime())
         RunWait(@ComSpec & ' /c defrag ' & $aD[$c] & ' -a -v >> "' & $sLog & '"')
         FileWrite($sLog, @CRLF)
      Next
   EndIf
Next

Func _DateTime()
   Return @YEAR & '-' & @MON & '-' & @MDAY & '  ' & @HOUR & ':' & @MIN
EndFunc  ;==>_DateTime

Share this post


Link to post
Share on other sites

WinXP only.

Local $sLog = 'c:\DefragAll-log.txt'
Local $aD, $c, $c2

For $c2 = 1 To 2
   Select
      Case $c2 = 1
         $aD = DriveGetDrive("RAMDISK")
      Case $c2 = 2
         $aD = DriveGetDrive("FIXED")
   EndSelect
      
   If Not @error Then
      For $c = 1 To $aD[0]
         FileWriteLine($sLog, 'Drive ' & $aD[$c] & ' started  : ' & _DateTime())
         RunWait(@ComSpec & ' /c defrag ' & $aD[$c] & ' /f')
         FileWriteLine($sLog, 'Drive ' & $aD[$c] & ' finished : ' & _DateTime())
         RunWait(@ComSpec & ' /c defrag ' & $aD[$c] & ' -a -v >> "' & $sLog & '"')
         FileWrite($sLog, @CRLF)
      Next
   EndIf
Next

Func _DateTime()
   Return @YEAR & '-' & @MON & '-' & @MDAY & '  ' & @HOUR & ':' & @MIN
EndFunc  ;==>_DateTime

<{POST_SNAPBACK}>

Hello löl :D great i wörks very nice i use it and he defrag nice thx you ezzetabi ! :idiot:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...