Home > Commands A-M > Commands Da-Dr

DEFRAG


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Reorganizes the files on a disk to optimize disk performance. Do not use this command when Windows 2 or 3.x is running.

note: Win9x no problems.


Syntax

DEFRAG /?

DEFRAG [drive:] [/F] [/S[:]order] [/B] [/SKIPHIGH] [/LCD | /BW | /G0] [/H] [/V]

DEFRAG [drive:] [/U] [/B] [/SKIPHIGH] [/LCD | /BW | /G0] [/H] [/V]

DEFRAG [drive:] [/A] [/F] [/V]


Parameters
drive: (v6.0 NTXP)
Specifies the drive that contains the disk you want to optimize.

Switches
/? (NTXP)
Display help.
/A (NTXP)
Analyzes the volume and displays a summary of the analysis report.
/B (v6.0)
Restarts your computer after files have been reorganized.
/BW (v6.0)
Starts DEFRAG using a black and white color scheme.
/F (v6.0)
Defragments files and ensures that the disk contains no empty spaces between files.
(NTXP)
Forces defragmentation of the volume regardless of whether it needs to be defragmented.
/G0 (v6.0)
Disables the graphic mouse and graphic character set.
/H (v6.0)
Moves hidden files.
/LCD (v6.0)
Starts DEFRAG using an LCD color scheme.
/S (v6.0)
Controls how the files are sorted in their directories. If you omit this switch, DEFRAG uses the current order on the disk. The colon (:) is optional. The list describes each of the values you can use to sort files. Use any combination of the values, and do not separate these values with spaces.
/SKIPHIGH (v6.0)
Loads DEFRAG into conventional memory. By default, DEFRAG is loaded into upper memory, if upper memory is available.
/U (v6.0)
Defragments files and leaves empty spaces, if any, between files.
/V (v6.0)
UNDOCUMENTED. Verifies data as written to disk. This option slows the defragment.
(NTXP)
Displays the complete analysis and defragmentation reports.
When used in combination with /A, displays only the analysis report. When used alone, displays both the analysis and defragmentation reports.

Related

none


Notes
Network and INTERLNK drives

You cannot use DEFRAG to optimize network drives or drives created with INTERLNK.


Disk information reported by DEFRAG and CHKDSK

Disk information that DEFRAG reports differs from information that CHKDSK reports. DEFRAG reports hidden and user files as one number; CHKDSK reports numbers for each type. DEFRAG counts the root as a directory; CHKDSK does not. DEFRAG does not count the volume label as a file; CHKDSK does.


Start DEFRAG only from DOS

If you start DEFRAG from a program such as Microsoft Windows, you may lose data.


Examples

To load DEFRAG into conventional memory and specify that DEFRAG sort files according to the date they were created, from latest created to earliest created, type:

    DEFRAG C: /F /SD- /SKIPHIGH

This example fully optimizes drive C, but slows DEFRAG.


Errorlevels
Availability
External
DOS
v6.0 v6.10 v6.2 v6.21 v6.22 v6.23
Windows
none
Windows NT
NTXP NT2003