Sideway
output.to from Sideway
Draft for Information Only

Content

MS DOS Command: DEFRAG.EXE
 Description
 Syntax
 Parameters
 Remarks
  Network and INTERLNK drives
  Disk information reported by DEFRAG and CHKDSK
  Start DEFRAG only from MS-DOS
  DEFRAG exit codes
 Examples

MS DOS Command: DEFRAG.EXE

Reference from Microsoft MS-DOS cmd help

Description

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

Syntax

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

Parameters

drive: Specifies the drive that contains the disk you want to optimize.
/F Defragments files and ensures that the disk contains no empty spaces between files.
/U Defragments files and leaves empty spaces, if any, between files.
/S 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 following 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.
N In alphabetic order by name
N- In reverse alphabetic order by name (Z through A)
E In alphabetic order by extension
E- In reverse alphabetic order by extension (Z through A)
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 Restarts your computer after files have been reorganized.
/SKIPHIGH Loads DEFRAG into conventional memory. By default, DEFRAG is loaded into upper memory, if upper memory is available.
/LCD Starts DEFRAG using an LCD color scheme.
/BW Starts DEFRAG using a black and white color scheme.
/G0 Disables the graphic mouse and graphic character set.
/H Moves hidden files.

Remarks

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 MS-DOS

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

DEFRAG exit codes

The following list briefly describes the meaning of each DEFRAG exit code (ERRORLEVEL parameter):

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.

You can use the ERRORLEVEL parameter on the IF command line in a batch program to process exit codes returned by DEFRAG. For an example of a batch program that processes exit codes, see the CHOICE command.

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 the following command:

defrag c: /f /sd- /skiphigh

This example fully optimizes drive C, but slows DEFRAG.


©sideway

ID: 110700152 Last Updated: 7/25/2011 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Travel 18

Reference 79

Computer

Hardware 254

Software

Application 213

Digitization 37

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 431

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Set 1

Logic 1

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2025 Sideway . All rights reserved Disclaimers last modified on 06 September 2019