Defrag multiple drives in Windows XP

Here’s an easy way to defrag all your hard drives using Windows XP Disk Defragmenter tool. Unlike other versions of Windows (95, 98, ME, 2000), the defrag in Windows XP has a command line interface. That means, with the right batch file, you can easily defrag all of your hard drives.

First, we have to create the batch file. To do so, open Notepad (Start > Run > type “notepad”). This will launch Notepad. You could use any basic text editor (not Microsoft Word!), but if you’ve got Windows, you’ve got Notepad – so Notepad it is.

Next, we’ll make sure that “Word Wrap” is turned on in Notepad (from the menu bar, select Format and make a check mark next to Word Wrap if there isn’t one).

Third, we set the command to defrag your hard drive. You’ll want to repeat this for every hard drive in your PC.

defrag c: -f

So, if you have a C: hard drive and a D: hard drive, you would enter “defrag d: -f” on the next line, like this:

defrag c: -f
defrag d: -f

Next, we need to save this as a batch file. From the menu bar in Notepad, select File and “Save As”. You’ll want to save this file in your My Documents folder (so we can find it later). Name the file “defrag-hd.bat” (with the quotes!).

To run the defrag on all of your drives, simply double click on the defrag-hd.bat file in your My Documents folder. Or, for even simpler use, set this file up as a scheduled task and run it once a week or so!