Hubbry Logo
List of DOS commandsList of DOS commandsMain
Open search
List of DOS commands
Community hub
List of DOS commands
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Contribute something
List of DOS commands
List of DOS commands
from Wikipedia

This article lists notable commands provided by the MS-DOS disk operating system (DOS), especially as used on an IBM PC compatible computer. Other DOS variants as well as the legacy Windows shell, Command Prompt (cmd.exe), provide many of these commands. Many other DOS variants are informally called DOS, but are not included in the scope of the list. The highly related variant, IBM PC DOS, is included. The list is not intended to be exhaustive, but does include commands covering the various releases.

Each command is implemented either as built-in to the command interpreter, COMMAND.COM, or as an external program. Although prevailing style is to write command names in all caps, the interpreter matches ignoring case.

Commands

[edit]

APPEND

[edit]

Sets the path to be searched for data files or displays the current search path. The APPEND command is similar to the PATH command that tells DOS where to search for program files (files with a .COM, . EXE, or .BAT file name extension).

The command is available in MS-DOS versions 3.2 and later.[1]

ASSIGN

[edit]

Redirects requests for disk operations on one drive to a different drive. It can also display drive assignments or reset all drive letters to their original assignments.

The command is available in MS-DOS versions 3 through 5 and IBM PC DOS releases 2 through 5.[1]

ATMDM

[edit]

Lists connections and addresses seen by Windows ATM call manager.

ATTRIB

[edit]

Changes or views the attributes of one or more files. Defaults to display the attributes of all files in the current directory. The file attributes available include read-only, archive, system, and hidden attributes. The command has the capability to process whole folders and subfolders of files and also process all files.

The command is available in MS-DOS versions 3 and later.[1]

BACKUP and RESTORE

[edit]

These are commands to backup and restore files from an external disk. These appeared in version 2, and continued to PC DOS 5 and MS-DOS 6 (PC DOS 7 had a deversioned check). In DOS 6, these were replaced by commercial programs (CPBACKUP, MSBACKUP), which allowed files to be restored to different locations.[1]

BASIC and BASICA

[edit]

Environment for programming in BASIC. IBM computers had BASIC 1.1 in ROM, and IBM's versions of BASIC used code in this ROM-BASIC, which allowed for extra memory in the code area. BASICA last appeared in IBM PC DOS 5.02, and in OS/2 (2.0 and later), the version had ROM-BASIC moved into the program code. Microsoft released GW-BASIC for machines with no ROM-BASIC. Some OEM releases had basic.com and basica.com as loaders for GW-BASIC.EXE. BASIC was dropped after MS-DOS 4, and PC DOS 5.02. OS/2 (which uses PC DOS 5), has it, while MS-DOS 5 does not.

BREAK

[edit]

Instructs DOS to check whether the Ctrl and Break keys have been pressed before carrying out a program request.

The command is available in MS-DOS versions 2 and later.[1]

CALL

[edit]

Starts a batch file from within another batch file and returns when that one ends.

The command is available in MS-DOS versions 3.3 and later.[1]

CD and CHDIR

[edit]

Sets the working directory or with no arguments displays the current value. Both names, CD and CHDIR, refer to the same command and are abbreviations of the phrase "change directory".

The command is available in MS-DOS versions 2 and later.[1]

CHCP

[edit]

Either displays or changes the active code page used to display character glyphs in a console window. Similar functionality can be achieved with MODE CON: CP SELECT=yyy.

The command is available in MS-DOS versions 3.3 and later.[1]

CHKDSK

[edit]

Verifies a storage volume (for example, a hard disk, disk partition or floppy disk) for file system integrity. The command has the ability to fix errors on a volume and recover information from defective disk sectors of a volume.

The command is available in MS-DOS versions 1 and later.[1]

CHOICE

[edit]

Prompts the user to select one item from a set of single-character choices. The command was introduced as an external command with MS-DOS 6.0;[1][2] Novell DOS 7[3] and PC DOS 7.0. Earlier versions of DR-DOS supported this function with the built-in switch command (for numeric choices) or by beginning a command with a question mark.[3] This command was formerly called ync (yes-no-cancel).

CLS

[edit]

The CLS or CLRSCR command clears the terminal screen.

The command is available in MS-DOS versions 2 and later.[1]

COMMAND

[edit]

Start a new instance of the command interpreter.

The command is available in MS-DOS versions 1 and later.[1]

COMP

[edit]

Show differences between any two files, or any two sets of files.

The command is available in MS-DOS versions 3.3 through 5 and IBM PC DOS releases 1 through 5.[1]

COPY

[edit]

Makes copies of files.

The command is available in MS-DOS versions 1 and later.[1]

CTTY

[edit]

Defines the terminal device (for example, COM1) to use for input and output.[4]

The command is available in MS-DOS versions 2 and later.[1]

DATE

[edit]

Displays the system date and prompts the user to enter a new date. Complements the TIME command.

The command is available in MS-DOS versions 1 and later.[1]

DBLBOOT

[edit]

A batch file added to DOS 6.X Supplemental Disks to help create DoubleSpace boot floppies.[5]

DBLSPACE

[edit]

A disk compression utility supplied with MS-DOS version 6.0 (released in 1993) and version 6.2.[1]

DEBUG

[edit]

A primitive assembler and disassembler.

DEFRAG

[edit]

Analyzes the file fragmentation of a disk drive and defragments a drive. This command is called DEFRAG in MS-DOS/PC DOS and diskopt in DR-DOS.

The command is available in MS-DOS versions 6 and later.[1]

DEL and ERASE

[edit]

Deletes files. Both names provide the same functionality.

The command is available in MS-DOS versions 1 and later.[1]

DELTREE

[edit]

Deletes a directory along with all of the files and subdirectories that it contains. Normally, it will ask for confirmation of the potentially dangerous action. Since the RD (RMDIR) command can not delete a directory if the directory is not empty (except in Windows NT & 10), the DELTREE command can be used to delete the whole directory.

The deltree command is included in certain versions of Microsoft Windows and MS-DOS operating systems. It is specifically available only in versions of MS-DOS 6.0 and higher,[1] and in Microsoft Windows 9x. In Windows NT, the functionality provided exists but is handled by the command rd or rmdir which has slightly different syntax. In Windows 10, the command switch is RD /S or RMDIR /S.

DIR

[edit]

Displays the contents of a directory. Output consists of the disk's volume label and serial number; one directory or filename per line, including the filename extension, the file size in bytes, and the date and time the file was last modified; and the total number of files listed, their cumulative size, and the free space (in bytes) remaining on the disk. The command is one of the few commands that exist from the first versions of DOS.[1] The command can display files in subdirectories. The resulting directory listing can be sorted by various criteria and filenames can be displayed in a chosen format.

DISKCOMP

[edit]

Compares the complete contents of a floppy disk to another one.

The command is available in MS-DOS versions 3.2 and later and IBM PC DOS releases 1 and later.[1]

DISKCOPY

[edit]

Copies the complete contents of a diskette to another diskette.

The command is available in MS-DOS versions 2 and later.[1]

DOSKEY

[edit]

Adds command history, macro functionality, and improved editing features to the command-line interpreter.

The command is available in MS-DOS versions 5 and later.[1]

DOSSIZE

[edit]

Displays how much memory various DOS components occupy.[6]

DRVSPACE

[edit]

A disk compression utility supplied with MS-DOS version 6.22.[1]

ECHO

[edit]

Prints text to the DOS equivalent of the standard output stream. Usually, this means directly to the screen, but the output can be redirected, like any other command, to files or devices. Often used in batch file.

Another important use of the echo command is to toggle echoing of commands on and off in batch files. Traditionally batch files begin with the @echo off statement. This says to the interpreter that echoing of commands should be off during the whole execution of the batch file, thus resulting in a "tidier" output (the @ symbol declares that this particular command (echo off) should also be executed without echo.)

The command is available in MS-DOS versions 2 and later.[1]

EDIT

[edit]

A full-screen text editor, included with MS-DOS versions 5 and 6,[1] OS/2 and Windows NT to 4.0. The corresponding program in Windows 95 and later, and Windows 2000 and later is Edit v2.0. PC DOS 6 and later use the DOS E Editor and DR-DOS used editor up to version 7.

EDLIN

[edit]

DOS line-editor. It can be used with a script file, like debug, this makes it of some use even today. The absence of a console editor in MS-DOS/PC DOS 1–4 created an after-market for third-party editors.

In DOS 5, an extra command "?" was added to give the user much-needed help.

DOS 6 was the last version to contain EDLIN; for MS-DOS 6, it's on the supplemental disks,[1] while PC DOS 6 had it in the base install. Windows NT 32-bit, and OS/2 have Edlin.

EMM386

[edit]

Enables or disables EMM386 expanded-memory support on a computer with an 80386 or higher processor.

The command is available in MS-DOS versions 5 and later.[1]

ERASE

[edit]

See: DEL and ERASE

EXE2BIN

[edit]

Converts an executable (.exe) file into a binary file with the extension .com, which is a memory image of the program.

The size of the resident code and data sections combined in the input .exe file must be less than 64 KB. The file must also have no stack segment.

The command is available in MS-DOS versions 1 through 5. It is available separately for version 6 on the Supplemental Disk.[1]

EXIT

[edit]

Exits the current command processor. If the exit is used at the primary command, it has no effect unless in a DOS window under Microsoft Windows, in which case the window is closed and the user returns to the desktop.

The command is available in MS-DOS versions 2 and later.[1]

EXPAND

[edit]

The Microsoft File Expansion Utility is used to uncompress one or more compressed cabinet files (.CAB). The command dates back to 1990 and was supplied on floppy disc for MS-DOS versions 5 and later.[7][1]

FAKEMOUS

[edit]

An IBM PS/2 mouse utility used with AccessDOS. It is included on the MS-DOS 6 Supplemental Disk.[8][9] AccessDOS assists persons with disabilities.

FASTHELP

[edit]

Provides information for MS-DOS commands.

FASTOPEN

[edit]

Provides accelerated access to frequently-used files and directories.

The command is available in MS-DOS versions 3.3 and later.[1]

FC

[edit]

Shows differences between two files, or two sets of files.

The command is available in MS-DOS versions 2 and later – primarily non-IBM releases.[1]

FDISK

[edit]

Manipulates hard disk partition tables. The name derives from IBM's habit of calling hard drives fixed disks. FDISK has the ability to display information about, create, and delete DOS partitions or logical DOS drive. It can also install a standard master boot record on the hard drive.

The command is available in MS-DOS versions 3.2 and later and IBM PC DOS 2.0 releases and later.[1]

FIND

[edit]

A filter to find lines in the input data stream that contain or don't contain a specified string and send these to the output data stream. It may also be used as a pipe.

The command is available in MS-DOS versions 2 and later.[1]

FINDSTR

[edit]

A GREP-oriented FIND-like utility. Among its uses is the logical-OR lacking in FIND.

FINDSTR "YES NO MAYBE" *.txt
would find all TXT files with one or more of the above-listed words YES, NO, MAYBE.

FOR

[edit]

Iteration: repeats a command for each out of a specified set of files. The FOR loop can be used to parse a file or the output of a command.

The command is available in MS-DOS versions 2 and later.[1]

FORMAT

[edit]

Deletes the FAT entries and the root directory of the drive/partition, and reformats it for MS-DOS. In most cases, this should only be used on floppy drives or other removable media. This command can potentially erase everything on a computer's drive.

The command is available in MS-DOS versions 1 and later.[1]

GOTO

[edit]

Transfers execution to a specified label. Labels are specified at the beginning of a line, with a colon (:likethis).

The command is available in MS-DOS versions 2 and later.[1]

Used in Batch files.

GRAFTABL

[edit]

Enables the display of an extended character set in graphics mode.[10]

The command is available in MS-DOS versions 3 through 5.[1]

GRAPHICS

[edit]

A TSR program to enable the sending of graphical screen dump to printer by pressing <Print Screen>.

The command is available in MS-DOS versions 3.2 and later and IBM PC DOS releases 2 and later.[1]

HELP

[edit]

Gives help about DOS commands.

The command is available in MS-DOS versions 5 thru Windows XP. Full-screen command help is available in MS-DOS versions 6 and later.[1] Beginning with Windows XP, the command processor "DOS" offers builtin-help for commands by using /? (e.g. COPY /?)

IF

[edit]

A conditional statement, that allows branching of the program execution. It evaluates the specified condition, and only if it is true, then it executes the remainder of the command line. Otherwise, it skips the remainder of the line and continues with next command line.

Used in Batch files.

The command is available in MS-DOS versions 2 and later.[1]

INTERSVR and INTERLNK

[edit]

In MS-DOS; filelink in DR-DOS.

Network PCs using a null modem cable or LapLink cable. The server-side version of InterLnk, it also immobilizes the machine it's running on as it is an active app (As opposed to a terminate-and-stay-resident program) which must be running for any transfer to take place. DR-DOS' filelink is executed on both the client and server.

New in PC DOS 5.02, MS-DOS 6.0.[11][1]

JOIN

[edit]

Attaches a drive letter to a specified directory on another drive.[11] The opposite can be achieved via the SUBST command.

The command is available in MS-DOS versions 3 through 5. It is available separately for versions 6.2 and later on the Supplemental Disk.[1]

KEYB

[edit]

Selects a keyboard layout.

The command is available in MS-DOS versions 3.3 and later.[1]

From DOS 3.0 through 3.21, there are instead per-country commands, namely KEYBFR, KEYBGR, KEYBIT, KEYBSP and KEYBUK.

LABEL

[edit]

Changes the label on a logical drive, such as a hard disk partition or a floppy disk.

The command is available in MS-DOS versions 3.1 and later and IBM PC DOS releases 3 and later.[1]

LASTDRIVE

[edit]

Used in the CONFIG.SYS file to set the maximum number of drives that can be accessed.

The command is available in MS-DOS versions 3.0 and later.[12]

LINK4

[edit]

Microsoft 8086 Object Linker[13]

LOADFIX

[edit]

Loads a program above the first 64K of memory, and runs the program. The command is available in MS-DOS versions 5 and later.[1] It is included only in MS-DOS/PC DOS. DR-DOS used memmax, which opened or closed lower, upper, and video memory access, to block the lower 64K of memory.[14]

LOADHIGH and LH

[edit]

Loads a program into the upper memory area.

The command is available in MS-DOS versions 5 and later.[1]

It is called hiload in DR-DOS.

MD or MKDIR

[edit]

Makes a new directory. The parent of the directory specified will be created if it does not already exist.

The command is available in MS-DOS versions 2 and later.[1]

MEM

[edit]

Displays memory usage. It is capable of displaying program size and status, memory in use, and internal drivers. It is an external command.

The command is available in MS-DOS versions 4 and later and DR DOS releases 5.0 and later.[1]

On earlier DOS versions the memory usage could be shown by running CHKDSK. In DR DOS the parameter /A could be used to only show the memory usage.

MEMMAKER

[edit]

Starting with version 6,[1] MS-DOS included the external program MemMaker which was used to free system memory (especially Conventional memory) by automatically reconfiguring the AUTOEXEC.BAT and CONFIG.SYS files. This was usually done by moving TSR programs and device drivers to the upper memory. The whole process required two system restarts. Before the first restart the user was asked whether to enable EMS Memory, since use of expanded memory required a reserved 64KiB region in upper memory. The first restart inserted the SIZER.EXE program which gauged the memory needed by each TSR or Driver. MemMaker would then calculate the optimal Driver and TSR placement in upper memory and modify the AUTOEXEC.BAT and CONFIG.SYS accordingly, and reboot the second time.[15]

MEMMAKER.EXE and SIZER.EXE were developed for Microsoft by Helix Software Company and were eliminated starting in MS-DOS 7 (Windows 95); however, they could be obtained from Microsoft's FTP server as part of the OLDDOS.EXE package, alongside other tools.

PC DOS uses another program called RamBoost to optimize memory, working either with PC DOS's HIMEM/EMM386 or a third-party memory manager. RamBoost was licensed to IBM by Central Point Software.

MIRROR

[edit]

Saves disk storage information that can be used to recover accidentally erased files.

The command is available in MS-DOS version 5. It is available separately for versions 6.2 and later on Supplemental Disk.[1]

MODE

[edit]

Configures system devices. Changes graphics modes, adjusts keyboard settings, prepares code pages, and sets up port redirection.[16]

The command is available in MS-DOS versions 3.2 and later and IBM PC DOS releases 1 and later.[1]

MORE

[edit]

Paginates text, so that one can view files containing more than one screen of text. More may also be used as a filter. While viewing MORE text, the return key displays the next line, the space bar displays the next page.

The command is available in MS-DOS versions 2 and later.[1]

MOVE

[edit]

Moves files or renames directories.

The command is available in MS-DOS versions 6 and later.[1]

DR-DOS used a separate command for renaming directories, rendir.

MSAV

[edit]

Scans the computer for known viruses.[17][18]

The command is available in MS-DOS versions 6 and later.[1]

MSBACKUP

[edit]

Used to backup or restore files from one disk to another.

The New York Times said that MSBACKUP "is much better and faster than the old BACKUP command used in earlier versions of DOS, but it does lack some of the advanced features found in backup software packages that are sold separately.[19] There is another offering, named MWBACKUP, that is GUI-oriented. It was introduced for Windows for Workgroups (3.11).[20]

The MSBACKUP command is available in MS-DOS versions 6 and later.[1]

MSCDEX

[edit]

A driver executable which allows DOS programs to recognize, read, and control CD-ROMs.

The command is available in MS-DOS versions 6 and later.[1]

MSD

[edit]

Provides detailed technical information about the computer's hardware and software. MSD was new in MS-DOS 6;[1][21] the PC DOS version of this command is QCONFIG.[22] The command appeared first in Word2, and then in Windows 3.10.

MSHERC

[edit]

A TSR graphics driver supplied with Microsoft QuickC, QuickBASIC, and the C Compiler, to allow use of the Hercules adapter high-resolution graphics capability (720 x 348, 2 colors).[23]

NLSFUNC

[edit]

Loads extended nationalization and localization support from COUNTRY.SYS, and changed the codepage of drivers and system modules resident in RAM.[citation needed]

In later versions of DR-DOS 6, NLSFUNC relocated itself into the HiMem area, thereby freeing a portion of the nearly invaluable lower 640KiB that constituted the ”conventional” memory available to software.[citation needed]

The command is available in MS-DOS versions 3.3 and later.[1]

PATH

[edit]

Displays or sets a search path for executable files.

The command is available in MS-DOS versions 2 and later.[1]

PAUSE

[edit]

Suspends processing of a batch program and displays the message Press any key to continue. . ., if not given other text to display.

The command is available in MS-DOS versions 1 and later.[1]

PING

[edit]

Allows the user to test the availability of a network connection to a specified host. Hostnames are usually resolved to IP addresses.[24]

It is not included in many DOS versions; typically ones with network stacks will have it as a diagnostic tool.

POWER

[edit]

Turns power management on and off, reports the status of power management, and sets levels of power conservation. It is an external command.[25]

The command is available in MS-DOS versions 6 and later.[1]

PRINT

[edit]

Adds or removes files in the print queue. This command was introduced in MS-DOS version 2.[1] Before that there was no built-in support for background printing files. The user would usually use the copy command to copy files to LPT1.

PRINTFIX

[edit]

PROMPT

[edit]

Allows the user to change the prompt in the command screen. The default prompt is $p$g (i.e. PROMPT $p$g), which displays the drive, the current path, and a greater than sign ">" as the prompt, but can be changed to anything. PROMPT $d, displays the current system date as the prompt. Type PROMPT /? in the cmd screen for help on this function.

The command is available in MS-DOS versions 2 and later and IBM PC DOS releases 2.1 and later.[1]

PS

[edit]

A utility inspired by the UNIX/XENIX ps command. It also provides a full-screen mode, similar to the top utility on UNIX systems.[6]

QBASIC

[edit]

An integrated development environment and BASIC interpreter.

The command is available in MS-DOS versions 5 and later.[1]

RD or RMDIR

[edit]

Remove a directory (delete a directory); by default the directories must be empty of files for the command to succeed.

The command is available in MS-DOS versions 2 and later.[1]

The deltree command in some versions of MS-DOS and all versions of Windows 9x removes non-empty directories.

RECOVER

[edit]

A primitive filesystem error recovery utility included in MS-DOS / IBM PC DOS.

The command is available in MS-DOS versions 2 through 5.[1]

REM

[edit]

Remark (comment) command, normally used within a batch file, and for DR-DOS, PC/MS-DOS 6 and above, in CONFIG.SYS. This command is processed by the command processor. Thus, its output can be redirected to create a zero-byte file. REM is useful in logged sessions or screen-captures. One might add comments by way of labels, usually starting with double-colon (::). These are not processed by the command processor.

REN

[edit]

Renames a file. Unlike the move command, this command cannot be used to rename subdirectories, or rename files across drives. Mass renames can be accomplished by the use of the wildcards characters asterisk (*) and question mark (?).[26]

The command is available in MS-DOS versions 1 and later.[1]

REPLACE

[edit]

Replaces computer files or adds new files to a target directory.

The command is available in MS-DOS versions 3.2 and later.[1]

RESTORE

[edit]

See: BACKUP and RESTORE

SCANDISK

[edit]

Disk diagnostic utility. Scandisk was a replacement for the chkdsk utility, starting with MS-DOS version 6.2 and later.[1] Its primary advantages over chkdsk is that it is more reliable and has the ability to run a surface scan which finds and marks bad clusters on the disk. It also provided mouse point-and-click TUI, allowing for interactive session to complement command-line batch run. chkdsk had surface scan and bad cluster detection functionality included, and was used again on Windows NT-based operating systems.

SELECT

[edit]

Formats a disk and installs country-specific information and keyboard codes. It was initially only available with IBM PC DOS. The version included with PC DOS 3.0 and 3.1 is hard-coded to transfer the operating system from A: to B:, while from PC DOS 3.2 onward you can specify the source and destination, and can be used to install DOS to the harddisk.

The version included with MS-DOS 4 and PC DOS 4 is no longer a simple command-line utility, but a full-fledged installer.

The command is available in MS-DOS versions 3.3 and 4 and IBM PC DOS releases 3 through 4.[1]

This command is no longer included in DOS Version 5 and later, where it has been replaced by SETUP.

SET

[edit]

Sets environment variables.

The command is available in MS-DOS versions 2 and later.[1]

cmd.exe in Windows NT 2000, 4DOS, 4OS2, 4NT, and a number of third-party solutions allow direct entry of environment variables from the command prompt. From at least Windows 2000, the set command allows for the evaluation of strings into variables, thus providing inter alia a means of performing integer arithmetic.[27]

SETUP

[edit]

The command is available in MS-DOS versions 5 and later.[1] This command does a computer setup. With all computers running DOS versions 4 and later, it runs the computer setup, such as Windows 95 setup and Windows 98 setup.

SETVER

[edit]

A TSR program designed to return a different value to the version of DOS that is running. This allows programs that look for a specific version of DOS to run under a different DOS.

The command is available in MS-DOS versions 5 and later.[1]

SHARE

[edit]

Installs support for file sharing and locking capabilities.

The command is available in MS-DOS versions 3 and later.[1]

SHIFT

[edit]

Increases number of replaceable parameters to more than the standard ten for use in batch files. This is done by changing the position of replaceable parameters. It replaces each of the replacement parameters with the subsequent one (e.g. %0 with %1, %1 with %2, etc.).

The command is available in MS-DOS versions 2 and later.[1]

SIZER

[edit]

Used by MemMaker during the memory-optimization process. Not intended to be started directly from the command prompt.

SMARTDRV

[edit]

The command is available in MS-DOS versions 6 and later.[1]

SORT

[edit]

A filter to sort lines in the input data stream and send them to the output data stream. Similar to the Unix command sort. Handles files up to 64k. This sort is always case insensitive.[28]

The command is available in MS-DOS versions 2 and later.[1]

SUBST

[edit]

A utility to map a subdirectory to a drive letter.[11] The opposite can be achieved via the JOIN command.

The command is available in MS-DOS versions 3.1 and later.[1]

SYS

[edit]

A utility to make a volume bootable. Sys rewrites the Volume Boot Code (the first sector of the partition that SYS is acting on) so that the code, when executed, will look for IO.SYS. SYS also copies the core DOS system files, IO.SYS, MSDOS.SYS, and COMMAND.COM, to the volume. SYS does not rewrite the Master Boot Record, contrary to widely held belief.

The command is available in MS-DOS versions 1 and later.[1]

TELNET

[edit]

Remote terminal client. Often used to manage and test network connectivity.

TIME

[edit]

Display the system time and waits for the user to enter a new time. Complements the DATE command.

The command is available in MS-DOS versions 1 and later.[1]

TITLE

[edit]

Enables a user to change the title of their MS-DOS window.

TREE

[edit]

Graphically displays the path of each directory and sub-directories on the specified drive. An external command,

The command is available in MS-DOS versions 3.2 and later and IBM PC DOS releases 2 and later.[1]

TRUENAME

[edit]

Internal command that expands the name of a file, directory, or drive, and display its absolute pathname as the result. It will expand relative pathnames, SUBST drives, and JOIN directories, to find the actual directory.

For example, in DOS 7.1, if the current directory is C:\WINDOWS\SYSTEM, then

C:\WINDOWS\SYSTEM>TRUENAME ..\WIN.INI
C:\WINDOWS\WIN.INI

The argument does not need to refer to an existing file or directory: TRUENAME will output the absolute pathname as if it did. Also TRUENAME does not search in the PATH.
For example, in DOS 5, if the current directory is C:\TEMP, then TRUENAME command.com will display C:\TEMP\COMMAND.COM (which does not exist), not C:\DOS\COMMAND.COM (which does and is in the PATH).

This command displays the UNC pathnames of mapped network or local CD drives. This command is an undocumented DOS command. The help switch "/?" defines it as a "Reserved command name". It is available in MS-DOS version 5.00 and later, including the DOS 7 and 8 in Windows 95/98/ME. The C library function realpath performs this function. The Microsoft Windows NT command processors do not support this command, including the versions of command.com for NT.

TYPE

[edit]

Displays a file. The more command is frequently used in conjunction with this command, e.g. type long-text-file | more. TYPE can be used to concatenate files (type file1 file2 > file3); however this won't work for large files[dubiousdiscuss][citation needed]—use copy command instead.

The command is available in MS-DOS versions 1 and later.[1]

UNDELETE

[edit]

Restores file previously deleted with del. By default all recoverable files in the working directory are restored; options are used to change this behavior. If the MS-DOS mirror TSR program is used, then deletion tracking files are created and can be used by undelete.

The command is available in MS-DOS versions 5 and later.[1]

UNFORMAT

[edit]

MS-DOS version 5 introduced the quick format option (Format /Q) which removes the disk's file table without deleting any of the data. The same version also introduced the UNFORMAT command to undo the effects of a quick format, restoring the file table and making all the files accessible again.

UNFORMAT only works if invoked before any further changes have overwritten the drive's contents.[1]

VER

[edit]

An internal DOS command, that reports the DOS version presently running, and since MS-DOS 5, whether DOS is loaded high.

The command is available in MS-DOS versions 2 and later.[1]

VERIFY

[edit]

Enables or disables the feature to determine if files have been correctly written to disk (You can enable the verify command by typing "verify on" on Command Prompt and pressing enter. To display the current VERIFY setting, type VERIFY without a parameter. To turn off the feature, type "verify off"). If no parameter is provided, the command will display the current setting.[29]

The command is available in MS-DOS versions 2 and later.[1]

VOL

[edit]

An internal command that displays the disk volume label and serial number.

The command is available in MS-DOS versions 2 and later.[1]

VSAFE

[edit]

A TSR program that continuously monitors the computer for viruses.

The command is available in MS-DOS versions 6 and later.[1]

XCOPY

[edit]

Copy entire directory trees. Xcopy is a version of the copy command that can move files and directories from one location to another.

XCOPY usage and attributes can be obtained by typing XCOPY /? in the DOS Command line.

The command is available in MS-DOS versions 3.2 and later.[1]

See also

[edit]

References

[edit]

Further reading

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
The list of DOS commands encompasses the collection of text-based instructions available in (DOS) variants, such as Microsoft's , designed for managing files, directories, disks, and basic system operations through a . These commands, introduced with 1.0 in 1981, enable users to perform tasks like copying files, formatting disks, and displaying directory contents, forming the core interaction method for early personal computers before graphical user interfaces became prevalent. The commands are categorized into internal ones, which are embedded in the command processor () and reside in memory for quick execution, and external ones, which are separate files loaded as needed for more complex functions. DOS commands originated from Microsoft's adaptation of (also known as QDOS) for IBM's in 1981, drawing inspiration from earlier systems like while introducing features such as the (FAT) for disk management. Over successive versions—evolving from MS-DOS 1.0's basic utilities to MS-DOS 6.22's enhancements like memory optimization tools—the command set expanded to include over 80 instructions by the mid-1990s, supporting hierarchical directories (from ), networking, and international character sets. Notable internal commands include DIR for listing files, COPY for duplicating data, and DEL for deletion, while external commands like FORMAT, CHKDSK for disk error checking, and XCOPY for advanced copying with subdirectory support highlight the system's versatility in file and storage operations. This list remains a foundational reference for understanding command-line computing, influencing modern Windows Command Prompt tools and preserving techniques for legacy systems, batch scripting, and embedded environments. Commands often utilize switches (e.g., /P for pausing output) and wildcards (e.g., . for all files) to enhance flexibility, with syntax variations across DOS implementations like PC-DOS or . Comprehensive documentation, such as version-specific references, details syntax, parameters, error codes, and examples to aid users in and automation via batch files.

Overview

Historical Context

The origins of DOS commands trace back to , a developed by at Seattle Computer Products in 1980 for 8086-based hardware. Microsoft licensed in December 1980 for $25,000 and acquired full rights in summer 1981 for an additional $50,000, adapting it into to meet 's needs for the IBM PC. 1.0, released in August 1981 alongside the IBM PC as PC-DOS 1.0, provided basic file operations like copying and listing files but lacked advanced features such as subdirectories. The command set evolved significantly across versions to support growing hardware capabilities and user demands. 2.0, shipped in March 1983 with the PC XT, introduced subdirectories and hierarchical file structures, enabling more organized file management. 3.0 in 1984 added support for hard disks. By 5.0 in June 1991, enhancements included the full-screen EDIT command for text editing, along with undelete and unformat utilities to aid . 6.0 arrived in March 1993, followed by 6.2 in September 1993, which introduced SCANDISK for disk error checking as a replacement for and improved DEFRAG for optimizing file placement on drives. DOS commands drew heavy influence from CP/M, the dominant OS for microcomputers in the 1970s, adopting terse syntax to conserve memory and align with programmer expectations. For instance, the DIR command for listing directory contents and COPY for duplicating files mirrored CP/M equivalents, reflecting shared roots in minicomputer systems like DEC's DOS-11, while also incorporating Unix-like elements for broader compatibility. With the release of in 1995 and the end of the IBM-Microsoft partnership in 1993, commands began to decline as a standalone OS, integrated instead as a within the graphical environment, yet the command prompt endured for scripting and . By 2025, DOS commands persist in embedded systems, such as industrial hardware using 386-compatible chips for legacy applications, and through emulators like DOSBox-X, which accurately replicate DOS environments on modern platforms for software preservation and retro .

Command Types

DOS commands are broadly classified into two primary types: internal and external, based on how they are implemented and executed within the MS-DOS operating system. Internal commands are built directly into the COMMAND.COM file, the command interpreter that loads into memory during system boot. These commands are executed without needing to load additional files from disk, making them always available and faster to run due to the absence of file-loading overhead. Examples include DIR, which lists directory contents; COPY, for duplicating files; and DEL, for deleting files. In contrast, external commands are stored as separate executable files, typically with .COM or .EXE extensions, located on the disk. They must be loaded into memory from their respective files when invoked, which consumes more system resources and time compared to internal commands but enables more complex functionality. These commands are optional and depend on the presence of their files in the system's PATH. Representative examples are FORMAT.EXE, used for preparing disks, and CHKDSK.EXE, which checks disk integrity. External commands are generally reserved for advanced or resource-intensive operations that exceed the scope of the resident COMMAND.COM. Certain commands exhibit hybrid behavior across MS-DOS versions, functioning as either internal or external depending on the implementation. For instance, ATTRIB, which manages , is provided as an external file (ATTRIB.EXE). The distribution of command types evolved with versions; early releases like MS-DOS 1.x featured a limited set of external commands to conserve resources on basic hardware, while later versions such as 6.x expanded external utilities significantly, introducing tools like SCANDISK.EXE in MS-DOS 6.2 for enhanced disk repair capabilities.

File System Commands

Directory Operations

Directory operations in MS-DOS involve commands that enable users to navigate, create, and manage the hierarchical structure of directories on the file system, which was introduced with support for subdirectories in version 2.0 to accommodate growing storage needs on hard disks. Prior to this, MS-DOS versions 1.x used a flat file system without subdirectory support, limiting organization to the root directory. These commands are essential for organizing files within the FAT file system, where directories function as special files containing entries for subdirectories and files, and access may be influenced by file attributes such as read-only or hidden settings. The DIR command displays a list of files and subdirectories in a directory. Its syntax is DIR [d:][path][filename] [/P] [/W] [/S] [/B] [/A[[:]attributes]] [/O[[:]sortorder]] [/T[[:]timefield]] [/X] [/4], where options include /P to pause output, /W for wide list format, /S for subdirectories, /B for bare format, and /A to filter by attributes. Introduced as an internal command in MS-DOS 1.0, DIR supports wildcards and is fundamental for viewing directory contents, with output showing file sizes, dates, and attributes. The CD (or CHDIR) command changes the current working directory or displays the current one if no path is specified. Its syntax is CD [d:][path], where [d:] optionally specifies a drive and [path] can be an absolute path (e.g., CD C:\DOS), a relative path (e.g., CD SUBDIR), or .. to move to the parent directory (e.g., CD ..). If the specified directory does not exist, the command returns an error, such as "The system cannot find the path specified." Specifying a drive letter with CD changes the current directory on that drive but does not switch the current drive. To change the current drive, enter the drive letter followed by a colon (e.g., C:). The current directory on the new drive will be the last one used on that drive. Introduced in MS-DOS 2.0 alongside subdirectory support, CD became fundamental for path navigation in command-line operations. The (or ) command creates one or more new directories, including nested ones if the parent path exists. The syntax is MD [d:][path], where [path] specifies the directory name or full path (e.g., MD C:\NEWDIR or MD DIR1\SUBDIR to create a subdirectory). It requires write permissions on the parent directory and fails if the target already exists or if the path is invalid, displaying "Invalid path, not directory" or similar errors. Like , was added in 2.0 to enable hierarchical file organization, allowing users to build tree-like structures for better file management on larger volumes. The RD (or ) command removes a directory, but only if it is empty, meaning no files or subdirectories are present. Its syntax is RD [d:][path], targeting the specified directory (e.g., RD C:\EMPTYDIR), and it reports "The directory is not empty" if contents exist, preventing accidental . In versions up to 6.22, no built-in option like /S exists for recursive deletion with RD; instead, users must manually empty the directory using other commands before removal. For recursive directory deletion, the distinct DELTREE utility, introduced in 6.0, can be used with syntax DELTREE [/Y] [path], where /Y suppresses confirmation prompts. The TREE command graphically displays the structure of directories and optionally files on a drive or path, aiding in visualizing the file system hierarchy. The syntax is TREE [d:][path] [/F] [/A], where /F includes file names in the output and /A uses ASCII characters instead of extended graphics for text-based displays (e.g., TREE C: /F lists all files and subdirectories rooted at C:). Without parameters, it shows the current directory's structure. Introduced as an external command in MS-DOS 2.0, TREE leverages the new subdirectory capabilities to produce a branched diagram, with output redirectable to a file via > filename.txt for documentation purposes.

File Operations

File operations in MS-DOS encompass commands for duplicating, relocating, removing, and renaming files, enabling efficient management of file contents without altering underlying disk structures. These utilities support wildcard characters such as * for any characters and ? for single characters, allowing of multiple files matching patterns like *.txt. Unlike directory-specific , these commands operate on file paths relative to the current or fully specified locations. The COPY command duplicates one or more files from a source to a destination, preserving the original files. Its syntax is COPY [source] [destination] [/A] [/B] [/V] [/Y] [/N], where /A treats files as ASCII (adding Ctrl+Z markers), /B handles binary files without modifications, /V verifies copied by comparing bytes, /Y suppresses overwrite prompts, and /N uses short filenames. Introduced in 1.0, COPY supports concatenation of multiple sources into one destination and is an internal command executed directly by . XCOPY extends COPY for advanced file and directory tree duplication, including subdirectories. Syntax: XCOPY [source] [destination] [/S] [/E] [/A] [/D] [/V] [/Y] [/H] [/R], where /S copies nonempty subdirectories, /E includes empty ones, /A copies only archived files (resetting the attribute), /D copies only newer files, /V verifies, /Y skips prompts, /H includes hidden/system files, and /R overwrites read-only files. Introduced in MS-DOS 3.2 as an external command, it provides robust options for selective transfers, such as date-based filtering, making it suitable for backups. The MOVE command relocates or renames files and directories. It supports moving files across different drives but is limited to the same drive for directories. Syntax: MOVE [source] [destination] [/Y], with /Y suppressing overwrite confirmation. Available from 6.0 as an internal command, it combines renaming and relocation functionality, failing if the destination exists unless overwritten. DEL (or its alias ERASE) removes one or more files permanently from the , with deletions unrecoverable without tools like UNDELETE in supported versions. Syntax: DEL [files] [/P] [/F], where /P prompts before each deletion and /F forces removal of read-only files; wildcards are fully supported. An internal command from 1.0, it operates quietly by default but risks if misused on system files. REN (short for RENAME) changes the name of a file or directory without moving its location or contents. Syntax: REN [oldname] [newname], supporting wildcards for batch renaming, such as REN *.txt *.bak to append extensions. As an internal command since 1.0, it cannot alter paths or extensions independently and fails if the new name conflicts with an existing file. REPLACE updates or adds files in a target directory by matching names from a source, ideal for selective file substitution. Syntax: REPLACE [source] [destination] [/A] [/P] [/U], where /A adds new files without replacing existing ones, /P prompts before replacements, and /U updates only older destination files. Introduced in 3.2 as an external command, it scans subdirectories optionally and preserves during transfer. DELTREE recursively deletes directories and all contents, including subdirectories, files, and hidden/system items. Syntax: DELTREE [/Y] [path], with /Y bypassing confirmation prompts. Added in 6.0 as an external command, it provides a streamlined alternative to manual and RMDIR sequences for complete tree removal.

File Attributes

In , file attributes are metadata flags assigned to files and directories that control their visibility, accessibility, and behavior, such as read-only (R), hidden (H), system (S), and archive (A). These attributes help manage file protection and organization, with commands allowing users to view or modify them directly from the command line. The primary command for handling these attributes is ATTRIB, which supports wildcards for batch operations on multiple files. The ATTRIB command displays, sets, or clears using the syntax ATTRIB [+|-R] [+|-A] [+|-S] [+|-H] [drive:][path]filename [/S]. Here, + sets an attribute while - clears it: R for read-only (preventing modifications), A for archive (indicating changes since last backup), S for (marking essential OS files), and H for hidden (excluding from standard directory listings). For example, ATTRIB +R file.txt makes a file read-only, and ATTRIB -H *.doc /S removes the hidden attribute from all .doc files in the current directory and subdirectories. Without parameters, ATTRIB lists attributes for specified files; the /S switch applies changes recursively to subdirectories. This command is essential for maintaining file integrity, such as setting files to hidden and read-only during setup.

Disk and Storage Commands

Disk Preparation

Disk preparation in encompasses the initialization, partitioning, and labeling of disks to make them usable for file storage and system booting. These processes typically begin with low-level formatting to establish the physical structure, followed by partitioning for hard drives, and finally labeling for identification. Commands in this category primarily target floppy disks and hard drives, with warnings about irreversible during formatting operations. They form the foundational steps before higher-level file operations or maintenance can occur. The command initializes a disk by erasing all existing data, creating a new (FAT), , and while scanning for s. Its syntax is FORMAT drive: [/S] [/V] [/Q] [/U] [/1] [/4] [/8] [/B], where /S transfers system files (such as IO.SYS and MSDOS.SYS) to make the disk bootable, /V prompts for or assigns a volume label, /Q performs a quick format that skips scanning (available from 3.2), /U enables unconditional formatting without prompts, /1, /4, and /8 specify formats for single-sided floppies or custom densities (e.g., 1 side, 4 or 8 sectors per track), and /B allocates space on the disk for system areas during formatting. always issues a warning about and requires user confirmation before proceeding, ensuring accidental erasure is avoided. This external command is available from 1.0 and later versions. FDISK configures hard drives by creating, deleting, or modifying partitions, including primary, extended, and logical types, and sets up the (MBR) for information. It uses a menu-driven interface to partition the drive, limiting the total to four primary partitions or one extended partition containing logical drives, and requires subsequent formatting of partitions with FORMAT. Introduced in 3.2, with support for extended partitioning schemes from version 3.3 to accommodate larger drives, is an external command that operates only on fixed disks. In later versions ( 5.0 and above), the optional /STATUS switch displays the current partition status without entering the interactive . The SYS command transfers essential system files to a previously formatted disk, enabling it to boot without performing any formatting itself. Its syntax is SYS drive:, which copies files like IO.SYS, MSDOS.SYS, and from the current boot drive to the specified target drive. This external command, available from 1.0, requires the source drive to contain the system files and the destination to have sufficient space, but it does not verify or alter the disk's structure. LABEL assigns, changes, or removes a volume label on a disk, providing a human-readable identifier up to 11 characters long (no spaces or special characters allowed). Its syntax is LABEL [drive: [label]], where omitting the label displays the current one and prompts for input if needed. This internal command, introduced in MS-DOS 3.1, requires confirmation before overwriting an existing label and cannot be used on network drives or certain redirected drives. Volume labels appear in directory listings via the DIR command. The VOL command displays the volume label and serial number of a specified disk, aiding in quick identification without altering the disk. Its syntax is VOL [drive:], defaulting to the current drive if none is provided. Available as an internal command from 1.0 (with serial number display from version 4.0), it reports "no label" if none exists and shows the serial number generated during formatting for uniqueness. DISKCOPY creates an exact sector-by-sector copy of an entire to another, overwriting the destination and automatically formatting it if necessary. Its syntax is DISKCOPY drive1: drive2: [/1] [/V], where /1 limits copying to the first side (useful for single-sided disks) and /V verifies the copy against the source. This external command, present from 1.0, prompts for disk insertion and ejection, supports only floppy drives of matching type, and reports errors if mismatches occur. It is ideal for duplicating bootable floppies or backups. DISKCOMP compares two floppy disks track-by-track to detect differences in content or formatting. Its syntax is DISKCOMP drive1: drive2: [/1] [/8], where /1 compares only the first side and /8 limits to the first eight sectors per track. This external command, available from 1.0 (with full features from 3.2), prompts for disk swaps, requires identical disk types, and outputs a summary of matching or differing sectors, making it useful for verifying copies before maintenance tasks like .

Disk Maintenance

Disk maintenance commands in MS-DOS provide essential tools for verifying disk integrity, repairing file system errors, and optimizing storage performance to prevent data loss and improve efficiency. These utilities address issues such as lost clusters, bad sectors, and file fragmentation, which can arise from hardware faults or improper disk usage. Typically executed from the command prompt, they require careful application, often after unmounting the drive or booting from a floppy disk to avoid interference with active files. Following disk preparation steps like formatting ensures these commands operate on a stable structure. CHKDSK scans the specified drive for errors, including lost clusters and cross-linked files, and reports disk usage statistics such as total and free space. It operates on file systems and can mark bad sectors to prevent future allocation. The syntax is CHKDSK [drive:] [/F] [/V], where /F fixes logical errors by repairing the and , and /V provides verbose output listing every file on the drive. Without parameters, it performs a read-only check on the current drive. This command has been available since early versions and is an internal command loaded into memory. SCANDISK, introduced in MS-DOS 6.2, serves as an enhanced replacement for with improved handling of FAT12 and FAT16 file systems, including thorough surface scans for physical defects. It detects and repairs errors in the , , and directory entries, while also checking for invalid clusters and lost file fragments. The syntax is SCANDISK [drive:] [/ALL] [/SURFACE] [/CHECKONLY], where /ALL scans all drives sequentially, /SURFACE performs a non-destructive surface test to identify bad sectors, and /CHECKONLY runs a quick validation without repairs. As an external command, it requires the SCANDISK.EXE file on the boot disk and offers a graphical interface option for interactive use. DEFRAG, available from 6.0, reorganizes fragmented files on a drive to contiguous blocks, reducing seek times and enhancing overall on mechanical hard drives. Fragmentation occurs when files are split across non-adjacent clusters during repeated write operations, leading to slower access. The syntax is DEFRAG drive: [/U] [/B] [/F] [/V] [/S], where /F performs a full optimization including sorting files, /U lists unmovable files, /B runs in low-memory mode, /V provides verbose output, and /S sorts directories by specified order. It is an external command that analyzes the drive first and prompts for confirmation before proceeding, skipping drives in use by the operating . MIRROR, introduced in MS-DOS 5.0, creates a backup of critical disk structures including the boot sector, file allocation table, and root directory to enable recovery from formatting or sector failures, often used in conjunction with UNDELETE for file restoration. It installs a terminate-and-stay-resident (TSR) program to track sector changes for real-time mirroring. The syntax is MIRROR drive: [/T], where /T tests the installation without saving data, and multiple drives can be specified sequentially. As an external command, it stores mirror information in hidden files on the drive and must be loaded before any disk modifications. RECOVER, present in early versions, attempts to salvage readable data from disks damaged by bad sectors by reading files sector-by-sector and writing recoverable portions to new files with .REC extensions. It is a command-line-only tool suited for emergency situations where the is corrupted beyond repair. The syntax is RECOVER drive: [filename], where specifying a filename targets individual recovery, and without it, all files are processed sequentially. This external command destroys the original during operation, marking bad sectors as unusable, and requires the drive to be non-bootable. UNFORMAT, added in MS-DOS 5.0, reverses the effects of a quick format by restoring the original track layout, , and using mirror previously saved by the MIRROR command. It is ineffective without prior mirroring and focuses on logical recovery rather than physical repairs. The syntax is UNFORMAT drive: [/J] [/P], where /J jumps to the next track if the current is unreadable, and /P performs a parameter verification step. As an external command, it prompts for confirmation and reports the of recovered , but depends on the of the hidden mirror files.

Data Backup and Recovery

In , backup and recovery commands provided essential tools for preserving files against loss due to hardware failures, accidental deletions, or disk errors, enabling users to safeguard and retrieve critical from floppy disks or hard drives. These utilities were particularly important in early environments where was limited, and recovery often relied on (FAT) structures. The primary commands focused on tape or disk-based backups and undeletion mechanisms, evolving from basic line-command tools in early versions to more user-friendly interfaces in later releases. The command, introduced in 2.0, creates backup copies of specified files from a source drive to a destination, typically a floppy disk or tape drive, while preserving directory information for later restoration. Its syntax is BACKUP source dest [/S/D/A/F/M], where source and dest denote the drive paths, /S includes subdirectories, /D backs up files modified on or after a specified date, /A appends to an existing backup without erasing it, /F specifies the floppy disk size (e.g., 360 for 360 KB), and /M limits backups to files modified since the last backup. This command requires two drives for operation and formats the destination in a proprietary structure incompatible with standard file copying, ensuring during transfer. Paired with BACKUP, the RESTORE command restores files from a backup set to their original or specified locations, supporting selective recovery based on dates or modifications. Its syntax is RESTORE source dest [/S/P/D/A/M/B], with source as the backup drive and dest as the target path; /S restores subdirectories, /P prompts for confirmation on read-only or altered files, /D lists files without restoring, /A selects files archived on or after a date, /M restores only modified files since the last backup, and /B targets files backed up before a specified date. Available from 2.0, RESTORE is designed for compatibility with sets from versions up to 5.0 and cannot process backups created by later tools like MSBACKUP. MSBACKUP, introduced in MS-DOS 6.0, offers a menu-driven graphical interface for backups and restores, simplifying the process over command-line alternatives and supporting compression for efficient storage. Invoked by the syntax MSBACKUP, it allows users to select files, choose full/incremental/differential modes, and configure options like video display via switches such as /BW for black-and-white or /LCD for laptop compatibility. The tool generates catalogs tracking file details and is incompatible with older formats, requiring execution from a hard disk. For recovering accidentally deleted files on FAT file systems, UNDELETE, added in MS-DOS 5.0, scans for recoverable entries marked as deleted but not yet overwritten. Its syntax includes UNDELETE [/LIST/DOS/ALL/P], where /LIST displays recoverable files, /DOS recovers all user-deletable files with prompts, /ALL restores everything without confirmation, and /P purges the undelete directory; it requires prior setup with tools like MIRROR for tracking deleted entries. Enhanced in MS-DOS 6.0 with levels like Delete Sentry (using disk space for sentry files) or Delete Tracker (memory-resident monitoring), UNDELETE assesses file condition as Perfect, Excellent, Good, or Fair based on cluster integrity.

System Configuration Commands

Environment Settings

Environment settings in refer to commands that manage system variables, customize the command prompt display, and handle version reporting for compatibility purposes. These commands allow users to configure the dynamically, influencing how the system locates executables, displays information, and interacts with legacy applications. By adjusting environment variables and prompts, users can tailor the DOS session for specific tasks, such as scripting or running older software. The SET command is used to display, set, or remove environment variables in . Its syntax is SET variable=[string], where specifying a variable without a string displays its value, providing a string assigns or modifies it, and omitting the string after the equals sign clears the variable. For example, SET TEMP=C:\TMP creates an environment variable named TEMP pointing to the directory C:\TMP, which can direct temporary files for applications. To make such settings persistent across reboots, they are typically placed in the file during system initialization. Environment variables set with this command affect batch files and programs by allowing substitution with %variable%, enhancing scripting flexibility. The PATH command configures the directories searched by for files, preventing errors when running external commands. Its is PATH [[drive:]path[;...]], where multiple paths are separated by semicolons, and typing PATH alone displays the current setting. For instance, PATH C:\DOS;C:\UTILS sets the search order to the DOS directory followed by a utilities folder, appending to the existing path if %PATH% is used in supported versions. This command is essential for accessing programs without specifying full paths each time, as defaults to searching only the current directory otherwise. Path length is typically limited to around 128 characters in early DOS versions, though later versions like 6.0 and above allow longer paths when configured in . Customization of the command prompt appearance is handled by the PROMPT command, which alters the text displayed before user input. The syntax is PROMPT [text], where text incorporates literal characters and special codes like $P for the current drive and path, $G for the , and $N for the current drive letter. An example is PROMPT $P$G, which shows the full current directory followed by >, providing context for navigation. This internal command, available across versions, enhances usability by embedding dynamic information such as time ($T) or date ($D) into the prompt string. Version information is queried using the VER command, which simply displays the version number with the syntax VER. Executing it outputs a message like "MS-DOS Version 6.22", confirming the operating system edition for troubleshooting or compatibility checks. This command, originating in early and retained in Windows Command Prompt, provides a quick way to verify the environment without additional parameters. For compatibility with legacy applications, the SETVER command modifies the version table reported to programs, introduced in 5.0. Its syntax includes SETVER [drive:path]filename n.nn to add or update an entry, SETVER [drive:path]filename /DELETE [/QUIET] to remove one, and SETVER [drive:path] to display the table. For example, SETVER oldprog.exe 4.01 tricks the program into detecting 4.01 instead of the actual version, avoiding compatibility issues. The version table must be loaded via a DEVICE statement in for changes to take effect after reboot.

Device and Hardware Control

The Device and Hardware Control category in encompasses commands that manage configurations for peripherals such as serial ports, printers, and displays, as well as handling and disk integrity verification. These utilities allow users to tailor hardware interactions, redirect console operations, and ensure reliable data operations on physical devices, which was essential in the resource-constrained environments of early personal computing. Introduced primarily in versions and later, these commands reflect the system's evolution to support more complex hardware setups without requiring reboots in many cases. The MODE command, available since MS-DOS 2.0, configures settings for system devices including displays, printers (LPT ports), and serial ports (COM ports). Its general syntax is MODE [device:] [options], where options vary by device type; for printers, it uses MODE LPTn[:][cpl][,[lpi][,P]] to set characters per line (cpl) and lines per inch (lpi), with P enabling page pause; for serial ports, MODE COMn[:]baud[,parity[,databits[,stopbits[,P]]]] specifies communication parameters like baud rate (from 110 to 9600), parity (n for none, o for odd, e for even), data bits (typically 7 or 8), and stop bits (1 or 2). It also supports display adjustments, such as MODE CON: COLS=80 to set the console to 80 columns, or printer redirection like MODE LPT1:=COM1: to route output to a serial port. Additionally, MODE LPT1: RETRY=BUSY configures retry behavior for busy printers, enhancing hardware reliability in print operations. This command was crucial for adapting to diverse peripherals without altering system files. CTTY, introduced in MS-DOS 2.0, redirects the controlling terminal for standard input and output to an auxiliary device, such as a for remote access via . The syntax is CTTY device, where valid devices include CON (console), COMn (serial ports), AUX (auxiliary, typically COM1), or LPTn (printers, though less common). For example, CTTY AUX shifts console control to the auxiliary port, allowing input from a connected terminal, while CTTY CON restores control to the keyboard and screen. This command was particularly useful in early networked or remote setups, enabling hardware-level console switching without rebooting, though it affects all subsequent I/O until changed. The BREAK command, present from 2.0 onward, toggles extended checking for Ctrl+C or Ctrl+Break interrupts during disk or system operations, influencing how the OS handles user interruptions in batch files or long-running tasks. Its syntax is BREAK [ON|OFF], with ON enabling more frequent interrupt checks (default is OFF for performance). When set to ON, it allows pausing or aborting operations like file copies more responsively, which is vital for hardware-intensive tasks on slower drives. In , it can be specified as BREAK=ON for system-wide effect. This control over interrupt handling helped prevent hangs in hardware-bound environments. VERIFY, also from MS-DOS 2.0, enables or disables verification of data written to disks during operations like COPY or , ensuring by reading back written sectors. The syntax is VERIFY [ON|OFF], where ON activates verification (default OFF to prioritize speed), and running VERIFY alone displays the current status. This slows disk writes significantly—potentially doubling time on mechanical drives—but detects errors from faulty hardware or media, making it essential for critical data on unreliable floppies or early hard drives. It applies only to block devices, not character devices like printers. Introduced in 3.0, the SHARE command installs support for and in multi-user or networked environments, managing concurrent access to files across hardware-connected systems. Its syntax is SHARE [/F:space] [/L:locks], where /F specifies bytes per file entry (default 2048) and /L sets the maximum number of locks (default 20); for example, SHARE /F:4096 /L:40 allocates larger buffers for environments with many open files. Running SHARE without options loads default support, requiring at least 64 KB of free . This was key for hardware sharing in LAN setups, preventing from simultaneous writes. The JOIN command, available since MS-DOS 3.1, joins a physical disk drive to a directory on another drive to simulate a larger virtual volume. The syntax is JOIN d: path to join drive d: to the specified path, or JOIN d: /D to disjoin; for instance, JOIN D: C:\DATA makes drive D appear as part of C:\DATA, allowing unified access to files across drives. It cannot be used on network drives or those substituted via SUBST, and was useful for hardware configurations with limited large disks, effectively pooling storage. Despite its utility, it was phased out due to complexities in modern file systems.

Locale and Display Settings

DOS provided several commands to manage locale-specific configurations, including character encoding for international text display, keyboard layouts for non-English languages, and basic screen management. These tools were essential for adapting the to different countries and languages, particularly in earlier versions like MS-DOS 3.3 and later, by supporting code pages that define character sets for consoles and devices. Code pages allowed the display of characters, such as accented letters or symbols, beyond the standard English set. The CHCP command changes the active code page for the console, affecting how characters are interpreted and displayed by DOS and applications. Its syntax is CHCP [nnn], where nnn specifies the three-digit code page number; without a parameter, it displays the current . For instance, supports English characters, while 850 enables multilingual European text, including accented characters like or . This temporary change applies to the current session and is crucial for proper rendering of non-English content on the screen. KEYB, introduced in MS-DOS 3.3, loads a keyboard layout to remap keys for international use, ensuring input matches the desired . The syntax is KEYB [xx[,mmm][,d:\path\filename]], where xx is a two-letter (e.g., for , FR for French), mmm is an optional number, and filename points to a keyboard definition file like KEYBUS.SYS. An example is KEYB US 437, which sets the US layout with the corresponding for seamless input of locale-specific characters. It requires prior loading of national language support for full functionality. GRAFTABL enables the display of extended characters in graphics modes on compatible adapters like CGA, EGA, or VGA, by loading the appropriate ROM-based character table into video memory. Available from 3.0, its syntax is GRAFTABL [nnn] or GRAFTABL /STATUS, where nnn is the (e.g., GRAFTABL 850 for multilingual support, including box-drawing symbols like │ or ┌). The /STATUS option queries the loaded . This command is particularly useful for applications rendering graphical text or borders in non-text modes. NLSFUNC loads country-specific data into memory to provide comprehensive national language support, enhancing commands like CHCP and KEYB by supplying formatting rules, currency symbols, and date conventions. Its syntax is NLSFUNC [d:\path\filename], typically using the COUNTRY.SYS file (e.g., NLSFUNC C:\DOS\COUNTRY.SYS). Executed from the command line or CONFIG.SYS, it prepares the system for locale adaptations, such as sorting orders or decimal separators, without which code page changes may fail. The CLS command simply clears the entire screen, resetting the cursor to the top-left position (row 1, column 1) for improved readability during command-line interactions. Its syntax is CLS, with no parameters required. As an internal command available in all MS-DOS versions, it helps manage display output by removing accumulated text without affecting underlying data or settings. Together, these commands facilitate non-English text handling on displays by coordinating code pages, input layouts, and visual clearing, often in tandem with device configurations for output consistency.

Batch and Scripting Commands

Control Structures

Control structures in batch files enable conditional execution, looping, and flow control, allowing scripts to respond to runtime conditions and process multiple items dynamically. These features, available since early versions of , form the foundation for automating repetitive tasks and creating structured programs within the limitations of the command interpreter. Primarily used in batch (.BAT) files, they support variables, handling, and subroutine-like behavior to enhance script . The IF command evaluates conditions and executes a command only if the condition is true, providing branching logic in batch programs. It supports three main condition types: error level checks, string equality comparisons, and file existence tests, with the optional NOT keyword to negate the condition. Variables enclosed in percent signs (%variable%) can be incorporated into string comparisons for dynamic evaluation. The command is an internal feature available from 2.0 onward.

IF [NOT] ERRORLEVEL n command IF [NOT] string1==string2 command IF [NOT] EXIST filename command

IF [NOT] ERRORLEVEL n command IF [NOT] string1==string2 command IF [NOT] EXIST filename command

For example, IF ERRORLEVEL 1 [ECHO](/page/Echo) Operation failed displays a message if the previous command returned an exit code of 1 or higher, aiding in error handling. String comparisons are case-sensitive and exact, while the EXIST test verifies file presence without checking directory validity. The FOR command loops through a specified set of files or strings, executing a command for each element, which is useful for files matching patterns. It requires the IN and DO keywords, with the loop variable as a single character (excluding digits 0-9). In batch files, use double percent signs (%%var); at the command prompt, use single percent (%var). Wildcards like * and ? are supported in the set, and the set must be enclosed in parentheses. This internal command dates to 2.0.

FOR %%var IN (set) DO command [command-parameters] (in batch files) FOR %var IN (set) DO command [command-parameters] (at command prompt)

FOR %%var IN (set) DO command [command-parameters] (in batch files) FOR %var IN (set) DO command [command-parameters] (at command prompt)

An example is FOR %%i IN (*.txt) DO TYPE %%i, which displays the contents of all .TXT files in the current directory. The set can include multiple patterns or literal strings separated by spaces, such as (file1.txt file2.doc *.bak). The command unconditionally jumps to a labeled line in a batch file, enabling non-linear execution for implementing loops, conditional branches, or subroutines. Labels are defined by a colon followed by a name (e.g., :START), where only the first eight characters after the colon are significant for matching. This internal command has been part of since version 2.0 and must be used within s, as it has no effect at the command prompt.

GOTO label :label

GOTO label :label

For instance, GOTO END skips to a label at the file's conclusion, avoiding unnecessary commands. When combined with IF, it supports conditional jumps, though overuse can reduce script readability. Introduced in 3.3, the CALL command invokes another or a labeled subroutine from within the current batch file, returning control to the caller upon completion rather than exiting the parent script. It accepts an optional drive, path, filename, and up to nine parameters (%1 through %9), which are passed to the called file as replaceable parameters. This internal command promotes and in scripting.

CALL [drive:][path]filename [batch-parameters]

CALL [drive:][path]filename [batch-parameters]

For example, CALL SUB.BAT %1 %2 executes SUB.BAT with the first two arguments from the parent, then resumes the parent. Recursive calls are possible but require an explicit EXIT to prevent infinite loops. The SHIFT command repositions batch parameters leftward, replacing %1 with the former %2, %2 with %3, and so on, up to %9, while discarding the original %1. This allows processing more than the standard nine parameters in a loop, as each SHIFT exposes the next argument. It is an internal command available from 2.0 and operates only within batch files. No parameters or options are required.

SHIFT

SHIFT

Typically used in a FOR loop, such as FOR %%i IN (%1 %2 %3 ...) DO (SHIFT & command %%i), it enables handling variable-length argument lists, like processing multiple files passed to a script. The %0 remains unchanged and holds the script's name.

Batch Utilities

Batch utilities in facilitate the creation and execution of batch files by providing commands for output control, user interaction, and script documentation, enabling more user-friendly and maintainable automated scripts. These tools are essential for suppressing verbose output, prompting user input, and adding explanatory notes without affecting program flow. Unlike control structures that handle conditional logic, batch utilities emphasize display and interaction aids to improve script readability and responsiveness. The command displays messages on the screen or toggles the echoing of commands in batch files. Its syntax is ECHO [ON|OFF|message], where ON enables command echoing (default behavior), OFF suppresses it to produce cleaner output, and a specified [message](/page/Message) prints custom text followed by a . For instance, @ECHO OFF at the start of a hides subsequent command lines from display while still executing them, a common practice for professional-looking scripts. Without parameters, ECHO reports the current echoing state, such as "ECHO is on." This command has been available since 2.0 and supports dynamic file creation via redirection, like ECHO CHKDSK > STARTUP.BAT. The PAUSE command suspends batch file execution until the user presses any key, displaying the prompt "Strike any key when ready..." (or a custom message if provided). Its syntax is PAUSE [message], making it ideal for scenarios requiring user intervention, such as changing disks or reviewing output before proceeding. Introduced in 1.0, it enhances interactivity; pressing Ctrl+C during the pause offers an option to terminate the batch job with "Terminate batch job (Y/N)?". An example usage is in a loop for multi-disk copies:

@ECHO OFF :Begin COPY A:*.* ECHO Put a new disk into Drive A PAUSE GOTO Begin

@ECHO OFF :Begin COPY A:*.* ECHO Put a new disk into Drive A PAUSE GOTO Begin

This halts after each copy operation, allowing disk swaps. The REM command inserts non-executable comments or remarks into batch files and CONFIG.SYS, improving script documentation without altering functionality. Its syntax is REM [message|comment], where the text following REM is ignored by the interpreter but visible if echoing is enabled. Available since MS-DOS 1.0, it serves as a readability aid, such as REM This batch file backs up critical data on 6/18/87, and can create vertical spacing if no comment is specified. Comments cannot include redirection (<, >) or pipe (|) operators, and blank lines achieve similar spacing effects while being ignored during processing. Introduced in 6.0, the command enables menu-based user selection in batch files by prompting for a single character from a defined list, setting the ERRORLEVEL to the choice's position (starting at 1) for subsequent conditional logic. Its syntax is CHOICE [/C:choices] [/N] [/S] [/T:c,nn] [message], where /C:choices specifies options (e.g., /C:YN for yes/no, defaulting to YN), /N hides the choice list from the prompt, /S enables , and /T:c,nn sets a default choice c after nn seconds timeout. A custom prompt follows the options, such as CHOICE /C:ABC /M "Select A, B, or C", which displays the message and awaits input, returning ERRORLEVEL 1 for A, 2 for B, or 3 for C. This utility revolutionized batch interactivity by replacing error-prone input parsing. Also debuting in 5.0, the DOSKEY command enhances command-line efficiency by maintaining a history buffer for recalling and editing previous commands, as well as defining keyboard macros. Its syntax includes DOSKEY [macroname=[text]] [/REINSTALL] [/LISTSIZE=size] [/MACROS] [/HISTORY] [/INSERT | /OVERSTRIKE], allowing macro creation like DOSKEY LS=DIR /W to alias "LS" to a wide directory listing. Users navigate history with , edit with function keys (e.g., F3 inserts text), and toggle insert/overwrite modes; macros support parameters via $1-$9 or $* for all arguments. As a TSR (, it loads into memory (about 3 KB) and persists across sessions unless reinstalled.

Text and Data Processing Commands

Viewing and Output

The TYPE command is an internal utility in , introduced in version 1.0, designed to display the contents of a specified directly to the console screen without modifying the file. Its basic syntax is TYPE [drive:][path]filename, where the filename parameter identifies the target , and drive/path are optional, defaulting to the current location if omitted. The command reads the file sequentially until encountering the marker (ASCII 26, or Ctrl+Z), expanding tab characters to spaces at eight-character intervals for readability. It processes only s effectively; attempting to view binary files results in garbled output or potential display errors due to non-printable characters, as the command lacks binary handling mechanisms. Wildcards are not supported in the filename parameter, limiting TYPE to single-file operations, though output can be redirected to other devices or piped to filters like MORE for . The MORE command, an external utility available from 2.0 onward, enables paginated viewing of text output to prevent overwhelming the console with long content. Its syntax supports input redirection as MORE < [drive:][path]filename to process a file directly or piping as command | MORE to filter the output of another command, such as TYPE or DIR. Upon execution, MORE displays approximately 23 lines per screen (depending on console settings) and pauses with a "-- More --" prompt at the bottom, requiring the user to press any key to advance to the next screenful. This key-press mechanism allows controlled scrolling through large outputs, with support for keyboard input, files, or pipes; the process can be interrupted via Ctrl+C or Ctrl+Break. In early versions like 3.x, options were minimal, focusing on basic pagination without advanced features like line skipping found in later Windows variants. PRINT, introduced as an external command in 2.0, facilitates background printing of text files to a specified device, spooling output to allow continued system use without blocking the console. The core syntax is PRINT [/D:device] [[drive:][path]filename[...]], where /D specifies the printer device (defaulting to PRN if omitted, typically LPT1), and one or more filenames can be listed for queuing. It handles only text files, converting them for line-printer output while maintaining a first-in-first-out (FIFO) queue that supports up to 10 files by default (configurable via /Q). Additional options include /B for buffer size (512-16384 bytes), /T to terminate the queue, and /C or /P for queue management, loading a terminate-and-stay-resident (TSR) spooler upon first use. This command queues print jobs efficiently for multi-file operations, though it requires a compatible parallel or serial port device and does not support graphics or binary formats natively. TRUENAME, an internal and largely undocumented command appearing in MS-DOS from version 3.0, resolves and displays the full, canonical path of a specified drive, directory, or file, expanding aliases, substitutions, or mapped drives to their underlying universal naming convention (UNC) equivalents. Its syntax is TRUENAME [drive:][path][filename], with parameters optional and defaulting to the current context if unspecified; it functions even for non-existent paths. Particularly useful in networked environments like Novell NetWare 3.1, TRUENAME reveals the true UNC path for substituted (via SUBST) or mapped network drives, aiding troubleshooting of path resolutions without altering the system. For example, it converts a shorthand like "D:\data" to "\server\share\data" if mapped, though it shows short 8.3 filenames in VFAT/FAT32 contexts and lacks wildcard support. This utility provides essential visibility into path expansions, complementing display commands by clarifying file locations in complex setups.

Searching and Filtering

The FIND command in MS-DOS searches for a specified text string within one or more files and displays the lines containing that string. Its basic syntax is FIND [/V] [/C] [/N] [/I] "string" [drive:][path]filename, where the string is enclosed in quotes, and optional switches modify the output: /V displays lines not containing the string, /C counts the number of matching lines without displaying them, /N prefixes each matching line with its line number, and /I performs a case-insensitive search. For example, FIND "error" log.txt outputs all lines in log.txt that include the word "error", while FIND /V /I "success" *.txt lists lines without "success" (ignoring case) across all text files in the current directory. This command, available since early versions of MS-DOS, is particularly useful for quick text searches in log or data files and can be combined with piping from viewing commands like TYPE to filter output streams in real time.

Sorting and Comparison

The SORT command is an external utility in MS-DOS used to alphabetically sort lines of text from an input source, such as a file or piped data, and direct the output to the screen, another file, or a device. Its basic syntax is SORT [/R] [/+n] < [drive:][path]filename [> [drive:][path]filename], where input is typically redirected using the less-than symbol (<) from a file or command, and output can be redirected using the greater-than symbol (>) to a file. The /R option performs a reverse sort in descending order, while /+n specifies the starting column (n) for sorting, allowing users to ignore leading characters in each line. By default, SORT processes data in ascending ASCII order and can handle inputs from text files viewed or generated by other commands, making it useful for organizing lists or logs. For file comparisons, the COMP command provides a byte-by-byte of two files or sets of files to identify differences, displaying mismatched bytes along with their positions. The syntax is COMP [drive:][path]filename1 [drive:][path]filename2 [/D] [/A] [/L] [/N:number] [/C], where filename1 and filename2 are the files to compare, and options include /D to show differences with decimal line numbers, /A to display differences in ASCII characters, /L to list only the line numbers of mismatches, /N:number to limit comparison to the first specified number of lines, and /C for case-insensitive matching. Introduced as an external command in 1.0, COMP is straightforward for verifying file integrity but operates primarily in binary mode and prompts interactively for additional file pairs if needed. The FC (File Compare) command offers a more advanced alternative to COMP, supporting both binary and line-by-line comparisons with detailed output of differences, and was introduced in 2.0. Its syntax is FC [drive:][path]filename1 [drive:][path]filename2 [/A] [/B] [/C] [/L] [/N] [/W], enabling users to compare files and display annotations for mismatches. Key options include /A for abbreviated line-by-line output showing only differing lines, /B for binary comparison mode similar to COMP, /C to ignore , /L for line-by-line textual comparison, /N to prepend line numbers, and /W to suppress differences in whitespace or line endings. As an external command, FC provides greater flexibility than COMP, particularly for text files, by highlighting contextual changes rather than raw byte offsets.

Utility and Development Commands

Text Editors

The MS-DOS operating system included two primary built-in text editors for creating and modifying ASCII text files, such as configuration files and batch scripts: the full-screen (EDIT) introduced in version 5.0, and the earlier line-oriented editor available from MS-DOS 1.0 onward. These tools were essential for users without access to third-party software, enabling basic text manipulation within the constraints of early personal environments. EDIT provided a more intuitive, graphical-like interface inspired by contemporary editors like QEdit, while EDLIN offered a lightweight, command-driven approach suitable for memory-limited systems. Both editors supported editing batch files, which are plain-text scripts executed by the interpreter. The , invoked via the EDIT command, is a full-screen, menu-driven tool that displays text in a windowed interface with menus for File, Edit, Search, Options, and Help. Its basic syntax is EDIT [drive:][path]filename, where the optional filename specifies the file to open; if omitted, a new file is created. Key switches include /B to force display for black-and-white monitors, /G to use mode for faster screen updating on CGA, EGA, or VGA displays, /H to display the maximum number of lines supported by the hardware (e.g., 43 or 50 lines on EGA/VGA), /NOHI to disable line highlighting for 8-color monitors, and /S to force the small memory model. Introduced with 5.0 in 1991, EDIT requires the .EXE runtime and supports features like block selection, cut/copy/paste operations, find/replace with case sensitivity, configurable tab stops (default 8 spaces), and mouse input if drivers are installed. (binary) mode for viewing and editing files as raw bytes can be accessed via the View menu after starting the editor. The interface resembles QEdit with adjustable color schemes, scroll bars, and a showing line/column positions, limited to files under 300 KB in the 16-bit version. Users access via F1 or the /H switch at the command line, which lists editing keys and shortcuts like Ctrl+Y for deleting lines. EDLIN, the earlier editor, uses a line-oriented, non-visual approach where the file is loaded into memory (up to 65,533 lines, 253 characters per line maximum) and manipulated via single-letter commands at a * prompt. Its syntax is EDLIN [drive:][path]filename [startline], loading the specified file and setting the current line pointer; if no file is given, it prompts for one. Core commands include L or [range]L to list lines (default 11 lines centered on the current line, or a specified range), E n to edit the nth line (reprints it for modification, using backspace or Ctrl+X to erase), A or I to append or insert lines after/before the current line, W [range] to write changes to disk (optionally a range, or until memory is three-quarters full), D [range] to delete lines, C source_range dest_line to copy a block, M source_range dest_line to move a block, S [range] string to search for text (with ? for interactive confirmation), and R [range] old_string new_string to replace text. Additional commands like P [range] page through the file 23 lines at a time, T line filename transfers another file's contents starting at a line, Q quits without saving, and E ends and saves (renaming the original to filename.BAK). Originating in MS-DOS 1.0 around 1981 and documented in versions like 3.20, EDLIN was primitive yet efficient, using minimal memory and supporting control character insertion (e.g., Ctrl+V then Ctrl+Z for EOF markers); it writes to disk automatically when memory fills and adjusts line numbers dynamically during edits. Despite its clunky interface lacking visual feedback, EDLIN remained available in early DOS versions for quick, lightweight tasks.

Debugging Tools

The DEBUG command serves as the primary assembly-level debugger in MS-DOS, enabling users to load, examine, modify, and execute programs at the level. Introduced with MS-DOS 1.0, it provides direct access to CPU registers, contents, and binary files, making it indispensable for low-level troubleshooting and development on 8086-based systems. To invoke DEBUG, the syntax is DEBUG [filespec], where filespec optionally specifies a file (such as a .COM or .EXE) to load into for analysis; without a file, it initializes an empty debugging session targeting the current state. Once active, DEBUG operates in an interactive mode with a (-) prompt, accepting single-letter subcommands to perform operations. Key subcommands include:
  • A [address]: Assemble mode, prompting the user to enter 8086/8088 assembly instructions, which are converted to machine code and stored starting at the specified segment:offset address (defaults to CS:100h if omitted). This facilitates on-the-fly code creation or patching.
  • U [address] [range]: Unassemble, displaying machine code from the given address (or range) as readable assembly mnemonics, aiding in reverse engineering or code verification.
  • G [=startaddress] [breakaddresses]: Go, executing the program from the start address (defaults to CS:100h) until completion or a breakpoint (up to 10 addresses allowed); the optional equals sign sets the initial execution point.
  • D [range]: Dump, outputting memory contents in hexadecimal bytes alongside ASCII equivalents for the specified range (e.g., D 100 L 20 for 32 bytes starting at offset 100h), essential for inspecting data structures or code segments.
Additional subcommands like E (enter/edit bytes), F (fill memory with values), N (name a file for ), and Q (quit) support comprehensive and file I/O, though all operations require familiarity with notation and segment addressing to avoid errors. DEBUG's design emphasizes simplicity for embedded debugging, but it lacks high-level source integration, limiting it to binary-level analysis. The EXE2BIN utility complements debugging by converting relocatable .EXE files to flat-model .COM binaries, stripping headers and relocation tables to produce compact, loadable code suitable for memory-constrained environments. Available since MS-DOS 1.1, it targets programs without segment fixups or stack segments, ensuring the output fits within a single 64KB segment. Its syntax is EXE2BIN [drive:][path]input.exe [ [drive:][path]output.bin [relocation_value] ], where the input is the source .EXE file (required, defaults to .EXE extension if unspecified), output is the optional destination (defaults to input name with .BIN or .COM extension), and relocation_value (in hex) specifies the base segment for fixups if needed (omitted for default 0000:0100h entry point). The conversion process deletes the .EXE header (typically the first 100h or 256 bytes), relocates code to offset 100h, and writes a pure binary file, reducing size and load time but requiring the original .EXE to have no relocation entries beyond the initial segment. If relocation is required, EXE2BIN prompts for a base segment value; otherwise, it reports errors like "Fixups needed" or "File cannot be converted" for incompatible files, such as those exceeding 64KB or containing invalid headers. Post-conversion, renaming the output to .COM allows direct execution via the command interpreter, facilitating integration with tools like DEBUG for further analysis.

Memory Management

Memory management in involves commands that allow users to monitor, allocate, and optimize the use of available RAM, particularly the limited 640 KB and upper memory blocks (UMBs) accessed via extended memory managers like EMM386. These tools were essential for running multiple programs efficiently on resource-constrained systems, preventing memory fragmentation and maximizing for applications. The command displays detailed information about current allocation. Its syntax is MEM [/C | /P | /F | /M], where /C or /CLASSIFY lists programs loaded in memory along with their sizes and the largest available block, /P or /PAGE pauses output for paging through screens, /F or /FREE shows free space in conventional and upper memory, and /M or /MODULE provides specifics on a named module's usage. Without options, it reports total, used, and free memory in conventional, expanded (EMS), and extended areas, helping diagnose allocation issues. This command is available from 5.0 onward and supports up to 64 MB of RAM in later versions. LOADHIGH (or its alias LH) loads programs into UMBs to conserve . The syntax is LOADHIGH [drive:][path]filename [parameters] or LH [drive:][path]filename [parameters], often used in for terminate-and-stay-resident (TSR) programs like drivers. It requires EMM386.EXE loaded in with the DEVICEHIGH or DOS=UMB options to enable UMB access, placing the program above the 640 KB boundary in available high regions. Advanced options include /L:region[,minsize] to target specific UMBs and /S to shrink allocated space post-loading. Introduced in 5.0, this command significantly improved multitasking by freeing low memory for primary applications. LOADFIX addresses compatibility issues with programs sensitive to memory placement near the 640 KB limit. Its syntax is LOADFIX [drive:][path]filename [parameters], which reserves the first 64 KB of (or a specified amount via optional size parameter) to force the program to load higher in low , avoiding "packed file corrupt" errors from TSRs or UMB conflicts. This ensures stable execution for legacy software expecting uninterrupted low access, without relying on upper . Available from 5.0, it is an external command (LOADFIX.COM). MEMMAKER, introduced in MS-DOS 6.0, automates memory optimization by analyzing and reconfiguring startup files. The syntax is MEMMAKER [/B], where /B enables batch mode for unattended operation (or black-and-white display). It scans and , relocates device drivers and TSRs to UMBs using , and creates backups (e.g., CONFIG.000, AUTOEXEC.000) for reversion via /UNDO. This process maximizes conventional free , often freeing 100-200 KB or more depending on the , while requiring an 80386+ processor and . Users should run it after initial setup but avoid during Windows sessions. SMARTDRV serves as a disk caching driver to enhance performance by buffering data in RAM, reducing physical disk accesses. Its syntax is SMARTDRV [InitCacheSize] [/L], where InitCacheSize sets the initial cache size in KB (defaulting to available extended memory, e.g., 2048 for 2 MB), and /L prevents SMARTDRV from loading itself into upper memory. Loaded via AUTOEXEC.BAT as an external command (SMARTDRV.EXE), it uses extended or upper memory for the cache, supporting read-ahead and write-behind modes; for systems with 1 MB or less extended memory, it falls back to conventional. Write-behind caching is enabled by default for hard disks. This can double or triple effective disk throughput for frequent operations. Available from MS-DOS 4.0 and refined in 6.0+, it integrates with EMM386 for optimal placement.

Specialized and External Commands

Storage Expansion

Storage expansion in MS-DOS was achieved through software-based techniques that compressed data on disks or created virtual drives to simulate additional storage capacity, allowing users to maximize limited hardware resources without physical upgrades. These methods were particularly valuable in the era of small hard drives and floppies, where commands like DBLSPACE and its successor DRVSPACE provided on-the-fly compression to effectively double available space in many cases. Other utilities, such as EXPAND for decompressing setup files and for mapping directories as drives, complemented these by facilitating efficient data handling and organization. The JOIN command, covered elsewhere, could be referenced for simulating multi-drive configurations by linking drives to subdirectories. DBLSPACE, introduced in 6.0, is a disk compression utility that compresses files on hard or floppy drives to create virtual larger volumes, typically achieving compression ratios up to 2:1 depending on data type. It operates by intercepting file I/O operations and transparently compressing/uncompressing data, mounting the result as a new drive letter for seamless access. Key syntax includes DBLSPACE /COMPRESS d: to compress an existing drive (with options like /reserve=size to allocate space for the compressed volume file), DBLSPACE /CREATE d: /size=size for new compressed volumes, and DBLSPACE /INFO [d:] to display details such as current ratios and free space. Users could also uncompress drives via DBLSPACE /UNCOMPRESS d: or list all compressed volumes with DBLSPACE /LIST. This tool required no additional hardware and integrated with MS-DOS's , though it demanded careful use to avoid data loss during compression. DRVSPACE, released in MS-DOS 6.2 as an enhanced replacement for DBLSPACE, offered improved compression algorithms that addressed reliability issues in the original, such as better error handling and reduced risk of corruption during operations. It mounted compressed drives similarly but used a more efficient storage format for the compressed volume files, enabling higher ratios and faster performance on average. The primary syntax mirrors DBLSPACE, with DRVSPACE /COMPRESS d: initiating compression (options include /newdrive=host: for assigning a host drive and /F for forced operation), and DRVSPACE /UNCOMPRESS d: for reversal. Additional commands like DRVSPACE /LIST provide status overviews, while integration with SCANDISK ensured pre-compression checks for disk errors, a feature refined from 6.0. DRVSPACE supported both express and custom installation modes, making it easier to apply or remove compared to its predecessor. The EXPAND command decompresses compressed files used in setup distributions, such as those with extensions like .EX_ for executables, thereby aiding in storage-efficient installations. Its syntax is EXPAND <source> <destination>, where <source> specifies the compressed file (wildcards supported), and <destination> is the output path; for example, EXPAND A:\SORT.EX_ C:\DOS\SORT.EXE extracts the SORT.EX_ file to the hard disk. Options like -R rename expanded files to match originals, -F:<files> target specific files, and -D lists contents without extracting. This utility was essential for retrieving core OS components from distribution media without manual unpacking tools. SUBST creates virtual drives by mapping a drive letter to a directory path, effectively expanding perceived storage by simplifying access to subfolders as if they were separate volumes. The syntax is SUBST <drive1>: <path>, such as SUBST E: C:\DATA to assign E: to the C:\DATA folder, allowing users to treat it as an independent drive for applications or batch files. To remove the mapping, use SUBST <drive1>: /D, and running SUBST without parameters lists active virtual drives. This command persisted across sessions if added to but required no disk modifications, making it a lightweight method for storage organization.

Graphics and Printing

The GRAPHICS command, introduced in PC DOS 2.0 and MS-DOS 3.2, loads a terminate-and-stay-resident (TSR) program that enables the printing of graphical screen contents to compatible dot-matrix printers, such as the IBM Personal Graphics Printer and Proprinter models. This utility enhances the standard Print Screen functionality by supporting graphics modes on color or graphics adapters like CGA, EGA, and VGA, allowing users to capture and print screen dumps at resolutions up to 640x200 pixels, often in sideways orientation for better fit. It was particularly useful for early applications involving visual output, such as simple games or diagrams, on hardware-limited systems without native graphics printing support. The syntax for the GRAPHICS command is GRAPHICS [printer] [/R] [/B] [/C] [/D], where [printer] specifies the device type (e.g., EPSON for Epson FX series, IBM for Proprinter, or defaults to PRN for the standard parallel port). The /R option resets the printer and loads default support, /B enables background color printing on compatible color printers (e.g., COLOR4 or COLOR8 models), /C centers the output, and /D specifies a custom profile file for non-standard printers. After loading, users press Shift+Print Screen to initiate the dump, with the program remaining in memory to handle subsequent requests until unloaded. Compatibility is limited to certain adapters; it does not work with Hercules monochrome cards or enhanced modes on some graphics adapters. For queuing graphics-enabled print jobs, the PRINT command's advanced /D option allows device selection, directing output to specific ports like LPT1-LPT3 (parallel) or COM1-COM4 (serial) when combined with GRAPHICS-loaded support. The full syntax is PRINT [/D:device] [drive:][path]filename, where /D:device routes the text-based queue to the chosen printer, enabling background processing of files that may include graphics commands interpreted by the loaded GRAPHICS routine. This was essential for managing print spools on systems with limited multitasking, ensuring graphics elements were handled without interrupting foreground tasks. The PRINTFIX utility, introduced in MS-DOS 6.x as part of the supplemental disk for version 6.22, serves to reset a stuck print spooler, clearing queues and restoring functionality without rebooting. Its simple syntax is PRINTFIX, executed directly at the command prompt to diagnose and repair spooler errors common in extended printing sessions involving graphics. At 234 bytes, it was a lightweight tool for troubleshooting printer hangs on older hardware. The GRAFTABL command supports printing and display of extended graphic characters (ASCII 128-255) in modes by loading tables into video memory, aiding compatibility for international or symbolic output on printers. Syntax is GRAFTABL [codepage], with common options like 437 () or 850 (Multilingual Latin I); for example, GRAFTABL 437 enables the default U.S. extended set. While primarily for screen rendering, it ensures consistent graphic character translation during print operations when used alongside or device drivers like PRINTER.SYS.

Networking and Security

DOS provided limited networking capabilities primarily through serial and parallel port connections between computers, enabling basic file and printer sharing without dedicated network hardware. Introduced in MS-DOS 6.0, the INTERLNK and INTERSVR commands facilitated this by establishing a direct link between two PCs, allowing the client (INTERLNK) to access the server's drives and printers as if they were local. The syntax for INTERLNK is INTERLNK [client[:]=[server][:]], where users specify drive mappings such as INTERLNK C:=D: E:=F: to redirect the client's C: and E: drives to the server's D: and F: drives, respectively; this supports drive redirection for seamless file transfers and . On the server side, INTERSVR uses the syntax INTERSVR [drive:[...]] [/X=drive:[...]] [/LPT:[n|address]] [/COM:[n|address]] [/BAUD:rate] [/B] [/V], with options like /COM:1 to select the and /BAUD:9600 to set the transfer speed, typically requiring identical cables and configurations on both ends for reliable operation. For enhanced access to that could integrate with networked environments, MSCDEX served as the CD-ROM Extensions, loading support for optical drives into . Introduced in 1988 for 3.3 and later, its syntax is MSCDEX /D:driver [/D:driver2...] [/E] [/K] [/S] [/V] [/L:letter] [/M:number], where /D:driver identifies the device driver (e.g., /D:MSCD001), /V enables verbose output for , and /M:count allocates buffers (up to 32) to improve performance during data reads. This command was essential for mounting s as assignable drives, such as D:, allowing DOS applications to treat them like hard disks for file access in shared setups. On the security front, 6.0 introduced basic antivirus tools to detect and mitigate threats in an era of floppy-based virus propagation. , the Microsoft Anti-Virus scanner, uses the syntax MSAV [drive:] [/S | /C] [/R] [/A | /L] [/N] [/P] [/F] [/VIDEO] [/MOUSE], with /S for scanning (default), /C to clean infected files, and /R to generate a report file (MSAV.RPT) detailing findings. It checks for known virus signatures across specified drives or the entire system, prompting user intervention for repairs, though its database was limited to prevalent threats of the time and required periodic updates via supplements. Complementing , VSAFE acts as a terminate-and-stay-resident (TSR) monitor that loads into (using about 22K) to watch for suspicious activities like file writes. Its syntax is VSAFE [/option[+ | -] ...] [/NE], where options include /E+ to alert on program executions and /W+ for , displaying warnings such as "VSAFE: Write Protect Violation" if a potential is detected. Users could unload it with the companion UNVSAFE command if conflicts arose. To optimize performance in networked or multi-user scenarios, FASTOPEN, introduced in 3.3, caches file and directory locations in for quicker access. The syntax is FASTOPEN drive:[[=]n] [drive:[[n][...]] [/X], loaded via as INSTALL=[path]FASTOPEN C:=64 /X to track up to 64 files on drive C: while excluding network drives with /X to prevent conflicts. This reduced disk seek times for frequently opened files, particularly beneficial in environments with shared resources, though it consumed up to 2K of per entry and was incompatible with certain disk utilities.

References

Add your contribution
Related Hubs
Contribute something
User Avatar
No comments yet.