Defrag command line switches

13 September 2007 by Snakefoot | Comment » | Trackback Off
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 KB Q283080
More Info Microsoft Windows XP - Defrag

Credits MaximumPCGuides.com

Updated: 31 October 2009

Comments:

Comment by u64 - 12 July 2009 @ 20:25 Reply

Does Vista defrag files works on XP…?

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

Leave a comment


NB! Use the Forum for computer help and off-topic questions.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>