taken from: http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx

There are a number of NT disk defraggers on the market, including WinternalsDefrag Manager. These tools are useful for performing a general defragmentation of disks, but while most files are defragmented on drives processed by these utilities, some files may not be. In addition, it is difficult to ensure that particular files that are frequently used are defragmented – they may remain fragmented for reasons that are specific to the defragmentation algorithms used by the defragging product that has been applied. Finally, even if all files have been defragmented, subsequent changes to critical files could cause them to become fragmented. Only by running an entire defrag operation can one hope that they might be defragmented again.

Contig is a single-file defragmenter that attempts to make files contiguous on disk. Its perfect for quickly optimizing files that are continuously becoming fragmented, or that you want to ensure are in as few fragments as possible.

Using Contig

Contig is a utility that defragments a specified file or files. Use it to optimize execution of your frequently used files.


srcContigReleaseContig.exe [-a] [-s] [-q] [-v] [existing file]

or srcContigReleaseContig.exe [-f] [-q] [-v] [drive:]

or srcContigReleaseContig.exe [-v] [-l] -n [new file] [new file length]

-a Analyze fragmentation
-f Analyze free space fragmentation
-l Set valid data length for quick file creation (requires administrator rights)
-q Quiet mode
-s Recurse subdirectories
-v Verbose

Contig can also analyze and defragment the following NTFS metadata files:

  •      $Mft
  •      $LogFile
  •      $Volume
  •      $AttrDef
  •      $Bitmap
  •      $Boot
  •      $BadClus
  •      $Secure
  •      $UpCase
  •      $Extend

How it Works

Contig uses the native Windows NT defragmentation support that was introduced with NT 4.0 (see my documentation of the defrag APIs for more information). It first scans the disk collecting the locations and sizes of free areas. Then it determines where the file in question is located. Next, Contigdecides whether the file can be optimized, based on free areas and the number of fragments the file currently consists of. If the file can be optimized, it is moved into the free spaces of the disk.

Categories: MicrosoftWindows

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts


PowerShell – Tips, Tricks and Useful Commands

Tip #4 –   #4                       Tip #3 – Comparison Operators Published date – May12, 2013 -eq   -ne   -gt   -ge   -lt Read more…


PowerShell TTUC #13 – Scheduled Jobs

PowerShell Tips, Tricks and Useful Commands (TTUC) #13 – Scheduled Jobs PowerShell scripts can be run as a scheduled job using using Windows scheduler.  Create a batch file with the following syntax/commands:   Powershell.exe “c:scriptsmytestscript.ps1” Read more…


PowerShell TTUC #15 – File Name with Time Stamp

PoweShell TTUC (Tips, Tricks and Useful Commands) #16 – File Name with Time Stamp File can be created with date / time suffix using the following syntax / commands: New-item -type file -Name (“MyFile_$(Get-Date -f Read more…