Disk defragmenter is a free Windows utility which comes shipped with all versions of Windows operating system. Whether you are using Windows XP, Windows Vista or Windows7, you can access Windows Disk defragmenter from Accessories . System tools > Disk defragmenter.
Before going into the details of defragmenting all your hard disk drives at once, let’s first understand why defragmenting of disks is to be done on a routine basis.
Why Defragment Your Hard Drives For Faster Windows Performance
Whenever you copy files and folders from an external source to any of your hard drives, Windows copies the files and allocates them a space randomly on the target partition. What that means is those files are not stored in a stack of already existing files or folders and new files are allocated a random space anywhere in the partition. In short, before defragmentation all the files and folders are stored non-contiguosly.
When you open any of the files or folders, Windows has to first find that file and perform your instructions. Hence, if all the files and folders on the system are stored randomly, Windows will require slightly more time to find the access location of a particular file or folder.
The same is true for installed programs and applications that run directly from your hard disk partitions. Whenever you install a new software or a computer game, the files and copied on the hard drive partition and stored on any allocated space. This non continuos nature of storing files slows down the response time of Windows and your system becomes slower.
How to Defragment All Hard Drive Partitions At Once – Windows XP, Windows Vista And Windows7
if you want Windows to respond faster, you should periodically defragment all your hard drive paritions and make sure that all the files, folders and software installations are present in contiguos file locations. Doing this will ensure faster file access, improved copyng speed and will lower down the response time of Windows to a great extent.
However, there is a slight problem with the disk defragmenter utility of Windows. It takes quite a good amount of time to defragment all hard drives and there is no option to bulk defragment all the hard drives, all at once.
For example: Let’s say your hard drive is divided into 6 partitions and you want to defragment all the partitions in one shot. This is not possible with Windows 7 or Windows XP disk defragmenter, as there is no option to defragment all hard drive partitions in one click. You have to manually defragment each partition one by one, which can consume a lot of time and needs human interference.
However, the following batch file will automate the process for you. Using this batch file trick, you can automatically defragment all system partitions in a single click, without having to do it manually. Here we go:
1. Open notepad or any text editor and add the following code for each hard drive partition which you want to defragment
defrag <hard-drive label>:-f
Example: If you wish to defragment only the D and E drive, add the following code
defrag d: –f defrag e: -f
If you need to defragment all your Hard drive include all your drives as shown above.
2. When you are done, save the document as a defrag.bat file, as shown below:
Remember to save the file as somename.bat and choose the save as type as “All files”. You are done!
Whenever you want to bulk defragment multiple hard drives or external storage devices using Windows Disk defragmenter, simply double click the batch file stored on your desktop. The batch file will automatically defragment all the defines partitions one by one, hence no manuall interference is required at all.
Another good idea would be to schedule this job on a given weekday by using Windows task scheduler. Let us know your ideas or questions in the comments section.
Tip: An Easy Way To Kill Multiple Windows Processes Using a Batch File