Difference Between ERASE and DEL in MS-DOS

In MS-DOS 6.22, there is no primary operational difference between the ERASE and DEL commands. Both commands are identical, built-in aliases within the COMMAND.COM shell that execute the exact same underlying routine to remove files. This article explains how these commands function under the hood, the historical reasons for having two identical commands, and how they behave in the operating system.

Internal Implementation in COMMAND.COM

Both DEL and ERASE are internal commands, meaning their execution logic resides directly inside COMMAND.COM rather than in separate executable files on disk (like FORMAT.COM or XCOPY.EXE).

When a user enters either command at the prompt, the command processor parses the arguments and invokes the exact same internal function. Neither command offers unique switches, elevated permissions, or distinct operational routines that the other lacks.

Syntax and Parameters

In MS-DOS 6.22, both commands accept the exact same syntax and parameters:

  • DEL [drive:][path]filename [/P]
  • ERASE [drive:][path]filename [/P]

The /P switch prompts for confirmation before deleting each specified file. Because they share the same parser, typing DEL file.txt /P produces the exact same prompt, error handling, and file system modifications as typing ERASE file.txt /P.

File Deletion Mechanics

When either DEL or ERASE is executed, MS-DOS 6.22 does not physically overwrite the file data on the storage drive:

  1. The first character of the file's name in the directory table is replaced with the byte E5h (hexadecimal), marking the entry as deleted.
  2. The clusters allocated to the file in the File Allocation Table (FAT) are marked as free (zeroed out) so new files can claim that space.
  3. The actual data remains intact on the storage media until overwritten by a subsequent write operation, allowing utilities like UNDELETE to recover the file if used promptly.

Historical Context

The presence of two names for the same action stems from backward compatibility. Early microcomputer operating systems like CP/M used the ERA command to delete files. When Tim Paterson created 86-DOS (which Microsoft later acquired and developed into MS-DOS), he retained ERASE to accommodate users familiar with CP/M while introducing DEL as a shorter, more intuitive alternative.

Microsoft maintained both commands across all subsequent releases of MS-DOS, including version 6.22, ensuring complete compatibility with legacy batch files and muscle memory. The choice between DEL and ERASE remains entirely a matter of user preference.