Turning Learners Into Developers
Codekilla
CODEKILLA
Operating Systems 8 min

Complete List of MS-DOS Commands with Examples

Read on to explore complete list of ms-dos commands with examples — a beginner-friendly walkthrough by Codekilla.

Rahul Chaudhary Thu Apr 30 2026
What is MS-DOS?

MS-DOS (Microsoft Disk Operating System) is a command-line operating system that dominated personal computing from 1981 through the mid-1990s. Unlike modern graphical interfaces where you click icons, DOS requires you to type text commands to manage files, run programs, and control your computer. Even though Windows replaced DOS decades ago, the Command Prompt in Windows still uses many DOS commands, making this knowledge surprisingly relevant for system administration, batch scripting, and troubleshooting.

Think of DOS commands as direct conversations with your computer's file system. Instead of dragging files to folders, you type COPY source.txt destination.txt. This directness gives you precise control and helps you understand what's actually happening under the hood when you perform everyday tasks.

Why It Matters
  • System administration: Windows Command Prompt and PowerShell still support legacy DOS commands for file management and system diagnostics
  • Batch automation: You can write .bat scripts using DOS commands to automate repetitive tasks across Windows systems
  • Troubleshooting: When graphical interfaces fail, the command line often remains accessible for system recovery
  • Understanding fundamentals: Learning DOS teaches you how operating systems manage files, directories, and processes at a basic level
  • Legacy system support: Many industrial and embedded systems still run DOS or DOS-compatible environments
File Management Commands

These commands handle the bread-and-butter operations of working with files—copying, moving, deleting, and viewing.

The DIR command lists directory contents, while COPY and XCOPY duplicate files. The difference? XCOPY handles subdirectories and has more options. DEL (or ERASE) removes files, and REN renames them. TYPE displays file contents directly in the console.

batch
REM Display all files in current directory
DIR

REM Copy a single file
COPY report.txt C:\backup\report.txt

REM Copy entire directory structure
XCOPY C:\projects D:\backup\projects /E /I

REM Delete a file
DEL oldfile.txt

REM Rename a file
REN draft.doc final.doc

REM Display text file contents
TYPE readme.txt
CommandPurposeExample
DIRList directory contentsDIR /P (pause after each screen)
COPYCopy one or more filesCOPY *.txt D:\backup
XCOPYCopy files and directory treesXCOPY /S /E source dest
DEL / ERASEDelete filesDEL *.tmp
REN / RENAMERename filesREN old.txt new.txt
TYPEDisplay file contentsTYPE config.sys
Directory Navigation Commands

Moving between folders requires different commands than graphical browsing. CD (Change Directory) is your primary navigation tool—use CD.. to move up one level or CD\ to jump to the root. MD (Make Directory) creates new folders, while RD (Remove Directory) deletes empty ones. The TREE command shows you a visual map of your directory structure.

batch
REM Show current directory
CD

REM Change to specific directory
CD C:\Users\Documents

REM Go up one level
CD..

REM Go to root directory
CD\

REM Create new directory
MD NewProject

REM Remove empty directory
RD OldProject

REM Display directory tree
TREE C:\Projects /F
Disk and System Commands

These commands interact with your storage devices and system configuration. FORMAT prepares disks for use (warning: destroys all data), CHKDSK scans for errors, and LABEL sets volume names. VOL displays the current volume label, while DISKPART in modern systems offers advanced disk management.

batch
REM Check disk for errors
CHKDSK C: /F

REM Display volume label
VOL C:

REM Set volume label
LABEL C: SYSTEM_DRIVE

REM Format a floppy disk (A: drive)
FORMAT A: /Q

REM Display disk information
DIR C:\ 

REM Clear the screen
CLS
CommandPurposeCaution Level
FORMATPrepare disk for use⚠️ HIGH - Erases all data
CHKDSKCheck disk integrityLow - Read-only by default
LABELChange volume nameLow
VOLDisplay volume infoNone - Read-only
File Attribute and System Configuration

DOS assigns attributes to files: Read-only, Hidden, System, and Archive. The ATTRIB command modifies these. Hidden files don't appear in normal DIR listings, read-only files can't be modified, and system files are critical OS components.

batch
REM View file attributes
ATTRIB myfile.txt

REM Make file read-only
ATTRIB +R important.doc

REM Remove read-only and make visible
ATTRIB -R -H secret.txt

REM Hide all text files in directory
ATTRIB +H *.txt

REM Display system configuration
SET

REM Show DOS version
VER

REM Display system time
TIME

REM Display/set system date
DATE
Batch File and Automation Commands

Batch files (.bat extension) let you chain DOS commands together. Control flow commands like IF, FOR, and GOTO add logic. ECHO displays messages, PAUSE waits for user input, and REM adds comments.

batch
@ECHO OFF
REM This is a backup script
ECHO Starting backup process...

IF EXIST C:\backup (
    ECHO Backup folder found
) ELSE (
    MD C:\backup
    ECHO Created backup folder
)

FOR %%F IN (*.doc) DO COPY %%F C:\backup

ECHO Backup complete!
PAUSE
Redirection and Piping

You can redirect command output to files or chain commands together. The > symbol writes output to a file (overwriting), >> appends, < reads input from a file, and | (pipe) sends one command's output to another.

batch
REM Save directory listing to file
DIR > filelist.txt

REM Append to existing file
DIR *.exe >> programs.txt

REM Display file page by page
TYPE longfile.txt | MORE

REM Find specific text in file
FIND "error" logfile.txt

REM Sort directory listing
DIR | SORT

REM Count lines in a file
FIND /C /V "" < document.txt
Quick Cheat Sheet
NeedReach for
List filesDIR or DIR /P for pagination
Navigate foldersCD foldername or CD.. to go up
Copy filesCOPY for single files, XCOPY /E for directories
Delete filesDEL filename or DEL *.ext for patterns
Create directoryMD dirname
View text fileTYPE filename.txt
Search in filesFIND "text" filename
Clear screenCLS
Get helpHELP commandname or commandname /?
Run programJust type the .exe name or full path
Common Mistakes
  • Forgetting /S with XCOPY: Without the /S switch, XCOPY won't copy subdirectories. You'll copy only the top-level files and wonder where everything else went.

  • Using DEL . without caution: This deletes EVERYTHING in the current directory. Always double-check your location with CD before running wildcard deletions.

  • Not checking if FORMAT is destructive: FORMAT erases all data on a drive. There's no "Are you sure?" in classic DOS—it just does it. Modern systems add warnings, but the command remains dangerous.

  • Mixing forward and backslashes: DOS uses backslashes (\) for paths, not forward slashes (/). Forward slashes are for command switches like /P or /S.

  • Forgetting ECHO OFF in batch files: Without @ECHO OFF at the start of your .bat file, every command displays before executing, cluttering your output with the command itself.

  • Assuming commands are case-sensitive: DOS commands ignore case (DIR = dir = DiR), but this habit can bite you when moving to Linux systems where case matters.

💡 Think Like a Programmer: DOS commands are the foundation of modern command-line interfaces—master these patterns, and you'll feel at home in PowerShell, Terminal, and Bash across any operating system.

// was this useful?
Did this article answer your question?
// Operating Systems · published by Codekilla
// related articles

Keep Reading