Defrag command line switches

Defrag.exe is a command line tool included with Windows, which is quite useful when wanting to perform a scheduled defragmentation of the hard disk. There are several command line switches available when running the tool:
  • Show available command line switches:

    defrag -?

  • Analysis of the partition to discover fragmentation level:

    defrag c: -a

  • Force defragmentation of the partition (Even if not having 15% free space available):

    defrag c: -f

  • Defragmentation of only the boot files on the partition:

    defrag c: -b

  • Display verbose information when displaying fragmentation statistics:

    defrag c: -v

New commands in Vista
  • Pause the defrag when the computer is not in idle state (Vista+):

    defrag c: /i

  • Complete defragmenation that includes all partitions (Vista+):

    defrag /c

  • Defrag all files independent of size. Performs by default a partial defragmentation excluding files larger than 64 MByte. (Vista+):

    defrag c: /w

New commands in Win7
  • Defrag all drives except those specified. (Win7+):

    defrag c: /e

  • Defrag using normal process priority, instead of low priority. (Win7+):

    defrag c: /h

  • Defrag each volume in parallel in the background. (Win7+):

    defrag c: /m

  • Defrag while printing progress information on the screen. (Win7+):

    defrag c: /u

  • Defrag with focus on free space consolidation, so there is contiguous free space for new files. (Win7+):

    defrag c: /x

Related Logical Prefetcher helps defrag to optimize file layout
Related Repair the builtin disk defragmenter
Related Different defragmentation utilities available

More Info MS KB283080
More Info Microsoft Windows XP - Defrag

Credits MaximumPCGuides.com

Updated: 9 August 2016

Comments:

  1. u64 says:

    Does Vista defrag files works on XP...?

    (Btw XP-defrag dont run on W2k. I used Contig.exe)

Leave a Reply

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