Wednesday, July 7, 2010

Using command line for Windows Disk Defragmenter

Windows Disk Defragmenter
Copyright (c) 2003 Microsoft Corp. and Executive Software International, Inc.
Usage:
defrag <volume> [-a] [-f] [-v] [-?]
  volume  drive letter or mount point (d: or d:\vol\mountpoint)
  -a      Analyze only
  -f      Force defragmentation even if free space is low
  -v      Verbose output
  -?      Display this help text

for example if you want to defrag Dirve D: and analyze onlydefrag D: -a

result is show below:
Windows Disk Defragmenter
Copyright (c) 2003 Microsoft Corp. and Executive Software International, Inc.
Analysis Report
    51.16 GB Total,  14.92 GB (29%) Free,  5% Fragmented (10% file fragmentation)
You do not need to defragment this volume.