ghacks Technology News

Defrag all Hard drives at once in Windows


The defragmentation tool that ships with Windows is pretty basic and does not offer features that are needed for instance if you have more than one partition or hard drive. Some users would like to defrag all of their hard drives at once while they go to work or sleep.

To do this you could use a simply batch script which would run a script that starts defrag sequentially for every hard drive installed. The user running the script needs admin rights or use a shortcut to run the batch file with admin rights.

I have four partitions with the drive letters C:, D:, E: and F: which means that the batch script will look like the following:



@echo off
defrag.exe c: -f
defrag.exe d: -f
defrag.exe e: -f
defrag.exe f: -f




Tags: , ,
Categories: Knowledge, Operating Systems, Windows


Read Related Posts


7 Responses to “Defrag all Hard drives at once in Windows”

  1. sspace says:

    In Vista you can defrag all volumes with the command:
    “defrag -c” from an administrator command prompt .

  2. khu says:

    Or you can just use ScanDefrag:

    http://www.blueorbsoft.com/scandefrag/

  3. Captain Picard says:

    This is a good tip; not many people know that you can defrag multiple drives in windows. But even so, the windows defraggers take way too much time to defrag, and often they dont do a good job. (eg. they dont defrag the $MFT AFAIK). The Vista defragger also seems to be crippled wrt available options and progress display.

    If you go out of the freeware arena, there are some good defraggers like Diskeeper Pro that make defragging easy and fast. DK gives better options for defragging single or multiple drives, and the defrags are also much faster compared to windows. But Diskeeper’s trump card is the autodefrag mode…set it and forget about manually defragging from that point on. Might sound like hype, but actually works really well.

  4. gnome says:

    Yp, scandefrag it is then! Nice one Khu

  5. mosey says:

    Sorry, newbie here – the line above goes into something called ‘batchfile.exe’ or something?

    Thanks :D

  6. Martin says:

    mosey just create a file called defrag.bat and double-click it to execute.

  7. mosey says:

    Martin: Thanks! :D I’ll give it a go!

Leave a Reply   Follow Ghacks   Subscribe To Comment Rss

© 2005-2009 Ghacks.net. All Rights Reserved. Privacy Policy - About Us