Fast Defrag within Windows

Dec 9, 2006 12:44 GMT  ·  By

You've bought yourself a new copy of Windows XP. I know this doesn't quite mirror the reality, taking into consideration that Vista is on the launch, but humor me. At one point, you will notice the system running slower and slower by the minute. The first maintaining job you have to do in this case is to perform a series of defragmentations on your disks.

Considering that users tend to get larger and larger storage devices and the amount of stored data is huge, it is recommended that you perform a defragmentation job every day. There is a myriad of applications on the Internet designed to help you with this task, but why would you spend money on an application that is already included in the OS you have just bought? And why should you spend time on the Web to look for a free, efficient defragmenting tool when all you need is Disk Defragmenter that comes with Windows XP package?

Some of the reasons could be that Disk Defragmenter can only defragment only one disk at a time. But the advantage is that you will get a visual of the defragmentation process as it happens. As it is recommended that the defragmenting disk should not be in use during this operation, you cannot but take each drive at a time to defragment.

Most users find it difficult to perform a manual defragmentation (you will have to go to Start>Programs>Accessories>System Tools>Disk Defragmenter, however, you can create a shortcut on your desktop for an easy access) and keeping the window open for the duration of the operation and closing it after the process is complete can be for some of you quite a drudgery. So, I searched and searched on the Internet until I found a quite simple solution for this.

Command lines are easy to create and even easier to use. Fortunately, you can create a command that will perform the defragmentation by simply clicking on a file on your computer. The best part is that you can get a report of the activity and choose the location on the desired drive.

It is easy to create and easy to use. All the additional applications you need is the trivial Notepad. So, open it and type in the file you want to launch. In our case-defrag.exe. Next, you have to input the drive you want to defragment. After defrag.exe, type in a space and the drive letter followed by a colon. The line should look like this by now: defrag.exe c: .

Name and save the .txt file to the location you want and change the extension from .txt to .bat or .cmd. My file is Softpedia.cmd. Up to now, you are setting Disk Defragmenter to do its job when drive C: is not in use.

Now run the file and see what happens. In my case, the window looks like the first screenshot at the end of the article. As you can see, an analysis report is generated giving you the size of the drive, the available disk space (percentage and size) and the percentage of its fragmentation. After the job is done, the window will close by itself. But maybe you would like to take a look at the report later, or maybe you are employed with a different job and you did not catch the log. Well, there is an answer for this too.

After defrag.exe c:, try typing in -v, followed by the > sign and by a quotation of the location on your computer where you want the report to be saved. My choice was C:Softpedia_defrag_log.txt so my line should look like this: defrag.exe c: -v>"c:Softpedia_defrag_log.txt". Not complicated at all in my opinion, as it is all very logical.

The report will be created in the location indicated by you and it will be overwritten every time you run the command. It will include both the analysis information as well as the defragmentation report.

It is well known that there should be a certain minimum amount of free disk space in order for the defragmentation to take place. The general value is 15%, but you can force the defragmentation to take place even if the free disk space on you disk is lower than this. You will simply need to add to the command a space and -f before the report generating function ( -v). Now, my final command looks like this: defrag.exe c: -f -v>"c:Softpedia defrag log.txt". And the command prompt window looks like the second screenshot at the end of the article.

Screenshot number 3 will display my defragmentation report in case you are interested. The best thing is that you can create the command to defragment more than one disk by simply adding the correspondent defragmentation command for a different drive.

That is about it, my final commands for defragmenting the two drives and generating a report of the activity are defrag.exe c: -f -v>"C:Softpedia defrag log C" and below is defrag.exe d: -f -v>"C:Softpedia defrag log D". I am sure that you can find a way to schedule the command at a certain hour and a certain day, as Windows XP also provides you with the necessary tool (Task Scheduler). Combine the two and you've got yourself a fine defragmenting scheduling tool for free.

Check the screenshots below:

Review image
Review image
Review image
Review image
Review image
Review image