Microsoft Defrag was first introduced with MS-DOS 6.0 and is a a software utility capable of organizing the files on the hard disk drive.

Defrag syntax

Below is a listing of available switches in MS-DOS Defrag 6.0 and above. It is important to note that these commands will not work in Windows 95 and above and defrag should never be ran while Windows is running in the background.

defrag Drive: /F /U /S:order /B /Skiphigh /LCD /BW /G0 /A /H

Drive:    Drive letter that you wish to defragment.
/F    Insures that no empty space remains between files.
/U    Leaves empty space if any is found between files.

/S:order

Sorts files in specific sort <order>.
N = Alphabetic name order.
-N = Reverse alphabetic name order.
E = In alphabetic file extension order.
-E = Reverse alphabetic file extension order.
D = In date order (earliest to latest).
-D = Reverse date order (old to new).
S = By file size (small to large)
-S = By file size (large to small)

/B    Reboot computer after completing defrag.
/Skiphigh    Load defrag into conventional memory.
/LCD    Start defrag in LCD color mode.
/BW    Start defrag in black and white color mode.
/G0    Disable mouse and character set.
/A    Start defrag in automatic mode.
/H    Move hidden files.

Examples

defrag c:

Defrag the main hard disk drive and correct any fragmented files.
How often should I run Defrag?

This is a commonly asked question with a difficult answer as every computer and computer user is different. We generally recommend that Defrag be ran at least once every 2-3 months. If the computer begins to run slowly running Defrag will also often help with performance issues.

Will running Defrag a lot cause physical problems?

Defrag is a software utility designed to arrange the data on the hard disk drive. Defrag will not cause any physical problems to the hard disk drive regardless of how many times it is ran.

Which versions of Microsoft Windows have Defrag?

Defrag was first introduced in MS-DOS 6.0 and was also available in all versions of MS-DOS after this version. Users who had these versions of MS-DOS with Windows 3.11 could also run Defrag. Defrag was also available in Microsoft Windows 95, Windows 98, Windows ME, Windows 2000, Windows XP, Windows Vista, and all later versions of Windows. Although each version of Windows has their own version of Defrag because of the different file systems and properties of the operating systems.
How to run Windows Defrag?

Windows 2000, XP, and Vista Defrag

Keep in mind that Windows 2000 and XP are network operating systems, and that if you are a user using Windows 2000 or XP on a network, your network administrator may have restricted users from running Defrag or from having any direct disk access. To run Defrag, we recommend you follow the below steps.

* Double-click My Computer
* Highlight the local hard disk drive by clicking on it once.
* Right-click the highlighted local drive
* Click Properties
* Click the Tools tab and click the Defragment now button.

Windows 95, 98, and ME Defrag

Windows 95 improved the functionality of Defrag as did Windows 98. To run Defrag from Windows, follow the below steps.

* Click Start
* Click Run and type Defrag in the run box
* Click ok
* Within the Defrag window, select the drive that you wish to be checked and click ok.

Windows NT Defrag

Windows NT is not shipped with Microsoft Defrag. However, various third-party companies offer utilities that can Defrag and check your hard disk drive for you. Symantec a well respected computer company, offers such a program.

Windows 3.x and MS-DOS Defrag

Defrag was first available in MS-DOS 6.0 and was available ever since. If you are running MS-DOS 6.0+ and would like to run Defrag, follow the below steps.

* If you are in Windows 3.x, click File and then Exit to get to the MS-DOS prompt.
* From MS-DOS type CD\DOS and press enter.
* From the C:\DOS> type Defrag and press enter, which should begin running Defrag on the computer.

Finally, some computer manufacturers have changed the installation directory of where Defrag is located if you are unable to run Defrag from DOS directory, go to the Windows directory by typing CD\Windows.