DEFRAG

Type: External (6.0 and later)

Syntax:

DEFRAG [d:] [/F][/S[:]order] [/B][/skiphigh [/LCD|/BW|/GO] [/H]
DEFRAG [d:] [/V][/B][/skiphigh] [/LCD]|/BW|/GO] [/H]

Purpose: Optimizes disk performance by reorganizing the files on the disk (new with DOS Version 6).

Discussion

You should start DEFRAG only from MS-DOS. Starting DEFRAG from a program such as Microsoft Windows may cause you to lose data. The following is a list of DEFRAG exit codes:

0 The defragmentation was successful.
1 An internal error occurred.
2 The disk contained no free clusters. To operate, DEFRAG needs 1 free cluster.
3 The user pressed CTRL+C to stop the process.
4 A general error occurred.
5 DEFRAG encountered an error while reading a cluster.
6 DEFRAG encountered an error while writing a cluster.
7 An allocation error occurred. To correct the error, use the SCANDISK command.
8 A memory error occurred.
9 There was insufficient memory to defragment the disk.


Options

/F - Used to defragment files, ensuring that the disk contains no empty spaces between files.

/U - Used to defragment files, leaving empty spaces between files.

/S - Used to control the way in which files are sorted in their directories. Without this option, the current order of files will be maintained. You can use any combination of the following sort options . Do not put spaces between the values.

N Alphabetical order by name.
N- Reverse alphabetical order by name.
E Alphabetical order by extension.
E- Reverse alphabetical order by extension.
D By date and time, earliest first.
D- By date and time, latest first.
S By size, smallest first.
S- By size, largest first


/B - Used to restart your computer after files have been reorganized.
/skiphigh Used to load DEFRAG into conventional memory, rather than in upper memory.

/LCD - Specifies an LCD color scheme.
/BW - Specifies a black and white color scheme.
/GO - Used to disable the graphic mouse and graphic character set.
/H - Used to move hidden files.

Example

If you want to load DEFRAG into conventional memory and run it specifying that the files on drive C be sorted alphabetically by name, enter the following:

defrag c: /f /sn /skiphigh



Return to Mission Control home page         Return to DOS Command Index