How to Defrag Multiple Hard Drives At Once

If you're new here, you may want to subscribe to Windows Reference RSS feed Thanks for visiting!


The Disk Defragment utility in Windows XP does not include a way to defragment all hard drives at the same time, which is inconvenient when you have more than one hard drive in your computer.

The method we are going to use is by creating a batch file to defragment all of the drives, one after the other.

Solution 1

The disk defrag utility in Windows XP can be triggered from the command line with the following syntax

Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.
Usage:
defrag <volume> [-a] [-f] [-v] [-?]
volume drive letter or mount point (d: or d:volmountpoint)
-a Analyze only
-f Force defragmentation even if free space is low
-v Verbose output
-? Display this help textFirst, we’ll create a file named defragall.bat, and place it anywhere you like, as long as you’ll remember where it is. If you want to run it from the command line, you could place it in the \windows directory so that it will be available in the system path.

For each hard drive, add a line to the batch file. For instance, if we want to defragment drives C: , D: , and F: we will add these three lines:

defrag c: -f
defrag d: -f
defrag f: -f

To run the defrag, just either double-click on the batch file or start it from the command line.

Solution 2

Create this archive .vbs!!! And create job in Scheduled Task!!!

‘——————————————————————————–

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

Dim fso, d, dc
Set fso = CreateObject(”Scripting.FileSystemObject”)
Set dc = fso.Drives
For Each d in dc
If d.DriveType = 2 Then
Return = WshShell.Run(”defrag ” & d & ” -f”, 1, TRUE)
End If
Next

  • Share/Save/Bookmark

Random Posts


Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader.

No comments yet.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required)