Here i discuss about the tool that is of paramount importance in a situation where you do not have time to defragment the entire drive and just want to defragment single file /folder in windows xp.

The tool i am discussing about is Contig it was developed by sysinternals and can be downloaded here. It is a tool that is operated through the command line.

The first thing you should do is download the tool it's only 100kb in size.

How To Use it ?

1. After downloading and extracting it, Open the command prompt on the folder containing the tool(use command prompt here tool) or for example If the tool is extracted in C:\abc then open command prompt and type cd "C:\abc" to make it the current directory. You can also set the path variable once and for all, see the tutorial on how to set the path variable [link] and after that the command can be invoked from any folder.

2.The tool has the following command line structure and options:

Command Structure : Contig [-options] filename.


1) v : for providing verbose output of the ongoing operation.

2) a : for analysis that is providing information of how fragmented a file or files have become.

3) q: The quiet mode switch , which over-rides the -v switch, makes Contig run in "quiet" mode, where the only thing it prints during a defrag run is summary information and no information regarding the ongoing operation is displayed.

4) s: Use the -s switch to perform a recursive processing of subdirectories when you specify a filename with wildcards.

For more options just type contig it will display the command help

Usage Examples:

1)If you want to defragment the entire directory and all the files under it then use the following command

contig -v -s "directory path\*.*"

For example: in my case directory is "C:\wamp" and i am using quiet mode ie -q option, So the command will be

contig -q -s "C:\wamp\*.*"

Output Image:

2)If you want to just defrag one file then simply use contig c:\dir_path\file_name .

Do leave your comment if post was helpfull.