Use this VBS script to run a defrag en SDelete on all your fixed drives from your computer

Set WshShell = WScript.CreateObject(“WScript.Shell”)

Dim fso, d, dc
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set dc = fso.Drives

WshShell.RegWrite “HKCU\Software\Sysinternals\”, 0, “REG_SZ”
WshShell.RegWrite “HKCU\Software\Sysinternals\SDelete\”, 0, “REG_SZ”
WshShell.RegWrite “HKCU\Software\Sysinternals\SDelete\EulaAccepted”, 1, “REG_DWORD”

For Each d in dc
If d.DriveType = 2 Then
Return = WshShell.Run(“sdelete -c ” & d, 1, TRUE)
Return = WshShell.Run(“defrag ” & d & ” -f”, 1, TRUE)’
End If
Next

Set WshShell = Nothing

Be sure that SDelete is located in the same directory as this VBS script.

Leave a Reply