DR DOS 9.0
USER GUIDE
==========
Copyright (c) 2022-2026 Whitehorn Ltd. Co.
All rights reserved.
DR DOS is a registered trademark of Whitehorn Ltd. Co.
WHITEHORN LTD. CO.
3963 S Highway 97 #214
Sand Springs, OK 74063
DISCLAIMER
Whitehorn Ltd. Co. provides this publication "as is" without warranty
of any kind, either express or implied, including but not limited to
the implied warranties of merchantability or fitness for a particular
purpose.
This publication may include technical inaccuracies or typographical
errors. Changes are periodically made to the information herein.
No part of this publication may be reproduced without the prior
written permission of Whitehorn Ltd. Co.
Last Modified: February 2026
===============================================================================
TABLE OF CONTENTS
===============================================================================
Chapter 1 ......................................... Installing DR DOS
Chapter 2 ......................................... Getting Started
Chapter 3 ......................................... Working with Files
Chapter 4 ......................................... Working with Directories
Chapter 5 ......................................... Running Programs
Chapter 6 ......................................... Advanced Features
Chapter 7 ......................................... Command Reference
Reporting Bugs and Issues
Appendix A ........................................ Error Messages
Appendix B ........................................ Batch Programming Guide
Glossary
===============================================================================
CHAPTER 1: INSTALLING DR DOS
===============================================================================
SYSTEM REQUIREMENTS
DR DOS 9.0 requires the following hardware:
Processor Intel 386 or compatible
Memory 2 MB RAM (minimum)
Display VGA-compatible display adapter
Storage FAT16 hard disk partition
BIOS LBA or CHS disk addressing
BETA SOFTWARE NOTICE
DR DOS 9.0 is currently in beta testing. This means you may encounter
bugs, crashes, system freezes, filesystem corruption, or compatibility
issues during use.
IMPORTANT PRECAUTIONS:
- Back up all important data before installation
- Do not use DR DOS 9.0 on production systems
- Test in a virtual machine or on non-critical hardware
- Be prepared for potential data loss
Your participation in beta testing helps us identify and fix issues.
Please report any problems you encounter (see "Reporting Bugs and
Issues" section).
SUPPORTED STORAGE
DR DOS 9.0 supports FAT16 hard disk partitions only:
Supported: FAT16 hard disk partitions
LBA disk addressing
CHS disk addressing
Drive letters: C: and D: drives only
NOT supported: FAT12 floppy disk boot
Additional drives beyond D:
INSTALLATION PROCEDURE
DR DOS 9.0 is distributed as a pre-configured bootable disk image.
CHOOSING A BUILD
DR DOS is available in two versions:
**Release Build (boot16.img.7z)** - Recommended for most users
- Optimized for performance
- Smaller kernel size
- COM1 serial port available for use
- Best for general use and testing applications
**Debug Build (boot16-debug.img.7z)** - For advanced troubleshooting
- Larger kernel size
- Slower performance
- Outputs detailed debugging logs to COM1 serial port
- COM1 NOT available for other uses (reserved for kernel debugging)
- Only needed when reporting complex bugs or system crashes
Most users should download the **release build** (boot16.img.7z).
Step 1: Obtain the disk image
Download boot16.img.7z from the DR DOS website (https://www.dr-dos.com).
Step 2: Extract the disk image
Use 7-Zip to extract the image file:
7z x boot16.img.7z
This creates boot16.img (approximately 120 MB).
Step 3: Write the image to bootable media
Use dd or a similar disk imaging tool to write the image to a
CompactFlash card, USB drive, or virtual disk:
dd if=boot16.img of=/dev/sdX bs=4M status=progress
Replace /dev/sdX with your target device identifier.
IMPORTANT: Ensure you specify the correct device. Writing to the
wrong device will destroy data on that device.
Step 4: Boot from the media
Configure your computer or emulator to boot from the media you
created. DR DOS will load automatically and present the command
prompt.
RUNNING IN QEMU
QEMU is a popular open-source emulator for testing DR DOS. Basic command:
qemu-system-i386 -m 16m -drive file=boot16.img,format=raw,if=ide -cpu 486
If using the debug build and want to capture debug logs:
qemu-system-i386 -m 16m -drive file=boot16-debug.img,format=raw,if=ide -cpu 486 -serial stdio
This displays debug output in the terminal. To save to a file instead:
qemu-system-i386 -m 16m -drive file=boot16-debug.img,format=raw,if=ide -cpu 486 -serial file:debug.log
The debug.log file will contain kernel debugging output.
WHAT'S INCLUDED
The DR DOS disk image includes:
- DR DOS 9.0 kernel and boot loader
- COMMAND.COM (command interpreter)
- Standard DOS utilities in C:\DOS\
- FAT16 filesystem pre-configured on drive C:
KNOWN LIMITATIONS
Be aware of the following limitations in this release:
Scripting
- FOR loops are not supported in batch files
- SET can display but not modify environment variables
File System Operations
- File date/time modification is not available
Advanced Features
- Input redirection (<) is not supported
- Append redirection (>>) is not supported
===============================================================================
CHAPTER 2: GETTING STARTED
===============================================================================
WHAT IS DR DOS?
DR DOS 9.0 is a disk operating system. It provides the essential
services that allow you to run programs, manage files, and organize
your hard disk. When you turn on your computer, DR DOS loads
automatically and presents you with a command prompt.
THE COMMAND PROMPT
After DR DOS starts, you will see a prompt that looks like this:
C:\>
This prompt tells you:
- The current drive (C:)
- The current directory (\, the root)
- That the system is ready for your command (>)
You type commands at this prompt and press ENTER to execute them.
DRIVES AND DRIVE LETTERS
DR DOS identifies disk drives with letters:
C: First hard disk partition
D: Second hard disk partition (if present)
NOTE: This version of DR DOS supports C: and D: drives only. Floppy
drives (A:, B:) are not supported in this release.
To switch to a different drive, type the drive letter followed by a
colon and press ENTER:
C:\>D:
D:\>
The prompt changes to show your new current drive.
CONVENTIONS USED IN THIS MANUAL
Commands are shown in UPPERCASE:
DIR
COPY
Parameters you supply are shown in lowercase:
COPY source destination
Optional parameters are shown in brackets:
DIR [drive:]
Literal characters you must type exactly are shown as-is:
C:\DOS\
BUILT-IN VS EXTERNAL COMMANDS
DR DOS commands fall into two categories:
BUILT-IN COMMANDS are part of COMMAND.COM itself and are always available,
even if no external files are present:
CD Change directory (also: CHDIR)
COPY Copy files
DEL Delete files (also: ERASE)
ECHO Display messages or control command echoing
EXIT Exit command interpreter
MD Create directory (also: MKDIR)
RD Remove directory (also: RMDIR)
REN Rename files (also: RENAME)
VER Display version
EXTERNAL COMMANDS are separate .COM program files that must be present in
the current directory or in C:\DOS\ to work:
BATCH Batch file interpreter (invoked automatically for .BAT files)
CLS Clear screen
DATE Display or set system date
DIR Directory listing
EDIT Full-screen text editor
HEXDUMP Display hexadecimal file dump
JMP Execute code at memory address
MEM Display memory information
MORE Page through text output
MOUSE PS/2 mouse driver (TSR)
MOVE Move files
PEEK Read byte from memory
POKE Write byte to memory
REBOOT Restart system
TYPE Display file contents
If you receive "Bad command or file name" for an external command, verify
that the corresponding .COM file exists in C:\DOS\ or the current directory.
===============================================================================
CHAPTER 3: WORKING WITH FILES
===============================================================================
FILE NAMES
Every file has a name consisting of up to 8 characters, optionally
followed by a period and an extension of up to 3 characters:
LETTER.TXT
REPORT.DOC
COMMAND.COM
CONFIG.SYS
The extension often indicates the type of file:
.COM Executable program
.EXE Executable program
.TXT Text file
.SYS System configuration file
File names cannot contain these characters:
< > : " | ? * / \
WILDCARD CHARACTERS
Two special characters help you work with groups of files:
* Matches any sequence of characters
? Matches any single character
Examples:
*.TXT All files with .TXT extension
REPORT.* All files named REPORT with any extension
FILE?.DOC FILE1.DOC, FILE2.DOC, FILEA.DOC, etc.
VIEWING FILES: DIR
The DIR command displays a list of files in a directory.
Syntax:
DIR [filespec] [/W]
Switches:
/W Wide format (5 columns, filenames only)
Examples:
DIR List all files in current directory
DIR *.TXT List all .TXT files
DIR /W List files in wide format
DIR D: List all files on drive D:
DIR displays the file name, size in bytes, and the total number of
files found. With the /W switch, DIR displays only file names in a
compact 5-column format.
VIEWING FILE CONTENTS: TYPE
The TYPE command displays the contents of a text file on screen.
Syntax:
TYPE filename
Example:
TYPE README.TXT
NOTE: TYPE is an external command. The file TYPE.COM must be in the
current directory or in the C:\DOS\ directory for this command to work.
TIP: For long files, use TYPE filename | MORE to page through the
output one screen at a time.
WARNING: Using TYPE on a program file (.COM or .EXE) will display
meaningless characters and may cause your screen to behave erratically.
Only use TYPE on text files.
COPYING FILES: COPY
The COPY command makes a duplicate of a file.
Syntax:
COPY source destination
Examples:
COPY LETTER.TXT LETTER.BAK
COPY D:DATA.TXT C:\DOCS\DATA.TXT
COPY REPORT.DOC D:
When copying to a drive without specifying a filename, the original
name is preserved.
NOTE: The COPY command copies one file at a time. Wildcard characters
are not supported in this version.
DELETING FILES: DEL
The DEL command deletes one or more files from your disk.
Syntax:
DEL filename
ERASE filename
Examples:
DEL LETTER.TXT
ERASE REPORT.DOC
DEL *.BAK
DEL and ERASE are identical commands.
CREATING DIRECTORIES: MD
The MD command creates a new directory.
Syntax:
MD dirname
MKDIR dirname
Examples:
MD DOCS
MKDIR BACKUPS
MD and MKDIR are identical commands.
RENAMING FILES: REN
The REN command renames an existing file.
Syntax:
REN oldname newname
RENAME oldname newname
Examples:
REN OLD.TXT NEW.TXT
RENAME LETTER.DOC LETTER.BAK
REN and RENAME are identical commands.
MOVING FILES: MOVE
The MOVE command relocates a file from one location to another. Unlike
COPY, the original file is removed after a successful move.
Syntax:
MOVE source destination
Examples:
MOVE OLDFILE.TXT NEWFILE.TXT
MOVE C:\DOCS\LETTER.TXT D:\BACKUP\
When moving to a directory, if the destination already exists, MOVE
will ask whether to overwrite it.
NOTE: MOVE is an external command. The file MOVE.COM must be in the
current directory or in the C:\DOS\ directory.
===============================================================================
CHAPTER 4: WORKING WITH DIRECTORIES
===============================================================================
WHAT IS A DIRECTORY?
A directory is a container for files. Directories can contain other
directories, creating a tree-like structure for organizing your files.
Every disk has a root directory, indicated by a single backslash (\).
All other directories branch from the root.
Example directory structure:
C:\
\DOS\
COMMAND.COM
TYPE.COM
MOVE.COM
\DOCS\
LETTER.TXT
REPORT.DOC
\PROGRAMS\
EDITOR.EXE
PATHS
A path describes the location of a file or directory. It consists of
an optional drive letter, followed by a series of directory names
separated by backslashes, ending with a filename:
C:\DOCS\LETTER.TXT
This path indicates:
- Drive C:
- In the DOCS directory
- The file LETTER.TXT
CHANGING DIRECTORIES: CD
The CD (Change Directory) command changes your current directory or
displays the current directory path.
Syntax:
CD [path]
Examples:
CD Display current directory
CD \ Go to root directory
CD \DOCS Go to DOCS directory
CD .. Go to parent directory
CD SUBDIR Go to subdirectory named SUBDIR
The CD command can also be typed as CHDIR.
===============================================================================
CHAPTER 5: RUNNING PROGRAMS
===============================================================================
EXECUTABLE FILES
Programs are stored as executable files with .COM or .EXE extensions.
To run a program, type its name (with or without the extension) and
press ENTER:
EDIT
EDIT.COM
MYPROG.EXE
DR DOS searches for the program in this order:
1. Current directory, with .COM extension
2. Current directory, with .EXE extension
3. C:\DOS\ directory, with .COM extension
4. C:\DOS\ directory, with .EXE extension
5. Current directory, with .BAT extension
6. C:\DOS\ directory, with .BAT extension
Batch files (.BAT) are text files containing a series of commands.
When a .BAT file is found, DR DOS automatically invokes the BATCH.COM
interpreter to execute it. See Chapter 6 for details on batch files.
NOTE: The search path is fixed to the current directory and C:\DOS\.
Unlike some other DOS systems, there is no configurable PATH
environment variable.
PASSING PARAMETERS TO PROGRAMS
Most programs accept parameters that control their behavior. Type
the parameters after the program name, separated by spaces:
TYPE README.TXT
COPY FILE1.TXT FILE2.TXT
MOVE /?
Consult the documentation for each program to learn its parameters.
EXITING PROGRAMS
Most programs return to the DOS prompt when they finish. Some programs
require you to type a command like EXIT or QUIT, or press a key
combination. Consult each program's documentation.
THE EXIT COMMAND
The EXIT command terminates the command interpreter. On most systems,
this will return you to the program that started COMMAND.COM.
If you type EXIT at the main DOS prompt (after booting), the system
may restart or halt. Use EXIT only when instructed by a program.
===============================================================================
CHAPTER 6: ADVANCED FEATURES
===============================================================================
OUTPUT REDIRECTION
DR DOS supports redirecting a command's output to a file using the
greater-than symbol (>).
Syntax:
command > filename
The output that would normally appear on screen is instead written
to the specified file. If the file already exists, it will be
overwritten without warning.
Examples:
DIR > FILELIST.TXT
DIR *.COM > PROGRAMS.TXT
MEM > MEMORY.TXT
This feature is useful for:
- Saving directory listings to review later
- Capturing program output for documentation
- Creating text files from command output
NOTES:
- Only output redirection (>) is supported
- Input redirection (<) is not supported
PIPING OUTPUT TO MORE
DR DOS supports piping command output to the MORE utility using the
pipe symbol (|).
Syntax:
command | MORE
The output of the command is displayed one page at a time, allowing
you to read through long output without it scrolling off the screen.
Examples:
DIR | MORE Page through directory listing
TYPE README.TXT | MORE Page through file contents
MEM /A | MORE Page through memory information
Controls when viewing output:
Space Display next page (23 lines)
Enter Display next line
Q or Esc Quit
NOTES:
- Currently only piping to MORE is supported
- Multiple pipes (cmd | cmd | cmd) are not supported
BATCH FILES
DR DOS supports batch file scripting. A batch file is a text file with a
.BAT extension that contains a series of commands to be executed in
sequence. Batch files are useful for automating repetitive tasks.
Creating a Batch File:
Use the EDIT command or any text editor to create a file with a .BAT
extension. Each line contains one command:
Example: CLEANUP.BAT
----------------------
@ECHO OFF
ECHO Cleaning up temporary files...
DEL *.TMP
DEL *.BAK
ECHO Done.
Running a Batch File:
Type the batch file name (with or without the .BAT extension):
C:\>CLEANUP
C:\>CLEANUP.BAT
Supported Batch Commands:
Flow Control:
REM comment Comment line (ignored)
ECHO message Display message on screen
ECHO OFF/ON Disable/enable command echoing
ECHO. Display a blank line
@command Execute command without echoing it
PAUSE Wait for a keypress
GOTO label Jump to a label
GOTO :EOF Exit the current batch file
:label Define a label
CALL filename [args] Execute another batch file and return
Conditionals:
IF EXIST file cmd Execute cmd if file exists
IF NOT EXIST file cmd Execute cmd if file does not exist
IF ERRORLEVEL n cmd Execute cmd if last exit code >= n
IF NOT ERRORLEVEL n cmd Execute cmd if last exit code < n
IF "s1"=="s2" cmd Execute cmd if strings are equal
IF NOT "s1"=="s2" cmd Execute cmd if strings differ
File Operations:
COPY src dest Copy a file
DEL file Delete a file (also: ERASE)
REN old new Rename a file (also: RENAME)
MD dirname Create a directory (also: MKDIR)
RD dirname Remove an empty directory (also: RMDIR)
CD path Change current directory (also: CHDIR)
Variables:
%0 - %9 Command-line parameters
%VARNAME% Environment variable expansion
SHIFT Shift parameters left (%1->%0, %2->%1, ...)
SET Display all environment variables
SET prefix Display variables starting with prefix
Redirection:
command > file Redirect output to a file
Parameter Substitution:
Batch files can accept parameters. Use %0 through %9 to reference them:
%0 The batch file name itself
%1 First parameter
%2 Second parameter
...
%9 Ninth parameter
Use SHIFT to access more than 9 parameters. Each SHIFT moves all
parameters down by one position (%2 becomes %1, %3 becomes %2, etc.).
Example batch file (BACKUP.BAT):
@ECHO OFF
ECHO Backing up %1 to %2...
COPY %1 %2
ECHO Backup complete.
Running: BACKUP.BAT README.TXT D:\BACKUP\README.TXT
Environment Variables:
Access environment variables using %VARNAME% syntax:
ECHO The current path is: %PATH%
IF "%COMSPEC%"=="" ECHO COMSPEC not set
Use SET to display all environment variables, or SET prefix to show
only variables starting with a specific prefix:
SET Display all variables
SET P Display variables starting with P
Conditional Execution:
The IF command allows conditional execution:
IF EXIST CONFIG.SYS ECHO Config file found
IF NOT EXIST TEMP MD TEMP
IF "%1"=="" ECHO No parameter provided
IF ERRORLEVEL 1 ECHO Program returned an error
ERRORLEVEL tests the exit code of the previous program. The condition
is true if the exit code is greater than or equal to the specified
value. Test higher values first:
PROGRAM.EXE
IF ERRORLEVEL 2 GOTO FATAL
IF ERRORLEVEL 1 GOTO WARNING
ECHO Success!
Labels and GOTO:
Use labels and GOTO for flow control:
@ECHO OFF
IF "%1"=="" GOTO USAGE
ECHO Processing %1...
GOTO END
:USAGE
ECHO Usage: PROCESS filename
:END
Use GOTO :EOF to exit the batch file immediately without requiring
an :END label.
Calling Other Batch Files:
Use CALL to execute another batch file and return to continue:
@ECHO OFF
ECHO Starting installation...
CALL SETUP.BAT
ECHO Setup complete, running configuration...
CALL CONFIG.BAT
ECHO All done!
Without CALL, executing a batch file transfers control permanently
and does not return to the calling script.
NOTES:
- Batch file support requires BATCH.COM in C:\DOS\
- Use SET to view environment variables
- Use SHIFT to process more than 9 parameters
AUTOEXEC.BAT - Automatic Startup Script
DR DOS automatically executes C:\AUTOEXEC.BAT at boot time if it exists.
This batch file runs once during system startup, before the first command
prompt appears.
If C:\AUTOEXEC.BAT does not exist, the system boots directly to the
command prompt with no error message.
Common uses for AUTOEXEC.BAT:
- Loading mouse drivers (MOUSE)
- Setting up the environment
- Displaying a welcome message
- Launching a menu or application
Example AUTOEXEC.BAT:
@ECHO OFF
ECHO Loading DR DOS...
MOUSE
ECHO.
ECHO Welcome to DR DOS 9.0
ECHO.
DEVICE NAMES
DR DOS recognizes several special device names that can be used in place
of filenames. These names are reserved and cannot be used for regular
files.
CON Console (keyboard input, screen output)
NUL Null device (discards all output, returns empty on input)
AUX Auxiliary device (typically COM1)
PRN Printer (typically LPT1)
The NUL Device:
The NUL device is particularly useful for discarding unwanted output:
DIR > NUL Run DIR but discard all output
COPY FILE.TXT NUL Test if file can be read (output discarded)
command > NUL Suppress output from any command
In batch files, use IF EXIST NUL to test if device names are available
(this always succeeds since NUL is a built-in device):
IF EXIST NUL ECHO Device support available
Device names are recognized in any directory context. You cannot create
a file named NUL, CON, AUX, or PRN.
EXPANDED MEMORY (EMS)
DR DOS includes a built-in LIM EMS 4.0 compatible expanded memory
manager, providing access to memory beyond the 640KB conventional
memory limit.
What is EMS?
Expanded Memory Specification (EMS) is a standard for accessing
additional memory on DOS systems. EMS memory is accessed through a
64KB "page frame" window in the upper memory area, with 16KB pages
that can be mapped in and out as needed.
DR DOS EMS Features:
- LIM EMS 4.0 compatible
- Page frame at segment D000h (standard location)
- Four 16KB physical pages (64KB page frame)
- Up to 32MB of expanded memory (limited by available XMS)
- 32 EMS handles maximum
- Uses XMS memory as backing store
EMS is available automatically when XMS memory is present. No
configuration or drivers are required.
Checking EMS Availability:
Use MEM to see expanded memory status:
C:\>MEM
The memory summary will show EMS memory if available.
Programs that Support EMS:
Many DOS applications can use EMS for additional memory:
- Spreadsheets (Lotus 1-2-3, Quattro Pro)
- Databases (dBASE, Paradox)
- Word processors (WordPerfect, Microsoft Word)
- Games (many titles from the late 1980s/1990s)
- RAM disks and disk caches
Consult each program's documentation for EMS configuration options.
Technical Details (for programmers):
EMS is accessed via INT 67h. Key functions:
AH=40h Get EMS status
AH=41h Get page frame segment
AH=42h Get total/free page count
AH=43h Allocate handle and pages
AH=44h Map logical page to physical page
AH=45h Deallocate handle
AH=46h Get EMS version (returns 4.0)
See Appendix B for batch file techniques. For EMS programming
details, consult the LIM EMS 4.0 specification.
EXTENDED MEMORY (XMS)
DR DOS includes a built-in XMS 2.0 compatible extended memory driver,
providing access to memory above the 1MB boundary on 386 and higher
processors.
What is XMS?
Extended Memory Specification (XMS) is a standard for accessing
memory above 1MB in real mode. Unlike EMS which uses page mapping,
XMS provides direct access to extended memory through block move
operations.
DR DOS XMS Features:
- XMS 2.0 compatible
- Automatic detection of available extended memory
- Up to 32 simultaneous memory handles
- High Memory Area (HMA) support for kernel
- Used as backing store for EMS driver
XMS is available automatically on systems with extended memory. No
configuration or drivers are required.
Checking XMS Availability:
Use MEM to see extended memory status:
C:\>MEM
The memory summary will show XMS memory if available.
High Memory Area (HMA):
The HMA is the first 64KB of extended memory (minus 16 bytes). DR DOS
loads part of its kernel into the HMA, freeing conventional memory
for applications. The HMA is managed automatically by the system.
Programs that Use XMS:
Many DOS applications and extenders use XMS:
- DOS extenders (DOS4GW, PMODE, etc.)
- Disk caches (SMARTDRV)
- RAM disks
- Large applications (compilers, CAD programs)
Technical Details (for programmers):
XMS is detected via INT 2Fh AX=4300h and accessed through an entry
point obtained via INT 2Fh AX=4310h. Key functions:
AH=00h Get XMS version (returns 2.0)
AH=08h Query free extended memory
AH=09h Allocate extended memory block
AH=0Ah Free extended memory block
AH=0Bh Move extended memory block
For XMS programming details, consult the XMS 2.0 specification.
CHANGING DRIVES
You can change the current drive by typing the drive letter followed
by a colon:
Syntax:
drive:
Examples:
C: Switch to drive C:
D: Switch to drive D:
The command prompt will update to show the new current drive. Each
drive maintains its own current directory, so switching back to a
drive returns you to the directory you were in on that drive.
CLEARING THE SCREEN
Use the CLS command to clear the screen and position the cursor at
the top-left corner.
Syntax:
CLS
NOTE: CLS is an external command. The file CLS.COM must be in the
current directory or in the C:\DOS\ directory.
===============================================================================
CHAPTER 7: COMMAND REFERENCE
===============================================================================
This chapter describes all available DR DOS commands in alphabetical
order.
-------------------------------------------------------------------------------
BATCH - Batch File Interpreter
-------------------------------------------------------------------------------
Executes batch file (.BAT) scripts. This command is invoked automatically
by COMMAND.COM when you run a .BAT file; you do not normally run it
directly.
Syntax:
BATCH filename [parameters]
Parameters:
filename The batch file to execute
parameters Optional parameters passed to the batch file as %1-%9
Supported Batch Commands:
Flow Control:
REM Comment (ignored)
ECHO Display text or control echoing
PAUSE Wait for keypress
GOTO Jump to label (including GOTO :EOF to exit)
:label Label definition
CALL Execute another batch file and return
@ Suppress echo for current line
Conditionals:
IF EXIST Test if file exists
IF ERRORLEVEL Test program exit code
IF "str"=="str" Compare strings
IF NOT Negate any condition
File Operations:
COPY Copy files
DEL/ERASE Delete files
REN/RENAME Rename files
MD/MKDIR Create directories
RD/RMDIR Remove directories
CD/CHDIR Change directory
Variables:
%0-%9 Parameter substitution
%VARNAME% Environment variable expansion
SHIFT Shift parameters left
SET Display environment variables
Redirection:
cmd > file Redirect output to file
Examples:
BATCH CLEANUP.BAT
BATCH INSTALL.BAT C:\GAMES
Notes:
- BATCH is an external command; BATCH.COM must be available in C:\DOS\.
- You typically run batch files by typing their name directly (e.g.,
CLEANUP or CLEANUP.BAT). COMMAND.COM automatically invokes BATCH.COM.
- See Appendix B for complete batch programming documentation.
Related commands: None
-------------------------------------------------------------------------------
CD - Change Directory
-------------------------------------------------------------------------------
Changes the current directory or displays the current directory path.
Syntax:
CD [drive:][path]
Parameters:
drive: The drive containing the directory (optional)
path The directory to change to
Examples:
CD Display current directory
CD \ Change to root directory
CD .. Change to parent directory
CD \DOS Change to \DOS directory
CD SUBDIR Change to SUBDIR within current directory
Notes:
- CD and CHDIR are identical commands.
- To change drives, type the drive letter followed by a colon
(for example, D:) rather than using CD.
Related commands: DIR
-------------------------------------------------------------------------------
CHDIR - Change Directory
-------------------------------------------------------------------------------
Identical to CD. See CD for details.
-------------------------------------------------------------------------------
CLS - Clear Screen
-------------------------------------------------------------------------------
Clears the screen and positions the cursor at the top-left corner.
Syntax:
CLS
Parameters:
None
Examples:
CLS
Notes:
- CLS is an external command; CLS.COM must be available in the
current directory or in C:\DOS\.
Related commands: None
-------------------------------------------------------------------------------
COPY - Copy Files
-------------------------------------------------------------------------------
Copies a file from one location to another.
Syntax:
COPY source destination
Parameters:
source The file to copy
destination The target filename or directory
Examples:
COPY README.TXT README.BAK
COPY D:DATA.TXT C:\BACKUP\
COPY LETTER.DOC D:
Notes:
- If the destination is a drive letter only (e.g., D:), the file
is copied with the same name.
- If the destination file already exists, it is overwritten without
warning.
- This version of COPY does not support wildcard characters.
Related commands: MOVE
-------------------------------------------------------------------------------
DATE - Display or Set Date
-------------------------------------------------------------------------------
Displays the current system date or sets a new date.
Syntax:
DATE [mm-dd-yyyy]
Parameters:
mm-dd-yyyy Optional new date (month-day-year)
Examples:
DATE Display current date and prompt for new date
DATE 12-25-2025 Set date to December 25, 2025
DATE 01/15/2026 Set date to January 15, 2026
Notes:
- DATE is an external command; DATE.COM must be available.
- When called without parameters, DATE displays the current date
with day-of-week and prompts for a new date.
- Date format is flexible: use -, /, or other delimiters.
- Two-digit years are interpreted as: 80-99 = 19xx, 00-79 = 20xx
- Valid year range: 1980-2099
- Press ENTER at the date prompt to keep the current date.
Related commands: None
-------------------------------------------------------------------------------
DEL - Delete File
-------------------------------------------------------------------------------
Deletes one or more files from the disk.
Syntax:
DEL filename
ERASE filename
Parameters:
filename The file to delete (may include wildcards)
Examples:
DEL LETTER.TXT
ERASE REPORT.DOC
DEL *.BAK
Notes:
- DEL and ERASE are identical commands.
- Wildcard characters are supported.
- The file cannot be read-only; it must have its read-only
attribute cleared first.
Related commands: COPY
-------------------------------------------------------------------------------
DIR - Directory Listing
-------------------------------------------------------------------------------
Displays a list of files and subdirectories in a directory.
Syntax:
DIR [drive:][path][filespec] [/W]
Parameters:
drive: The drive to list (optional)
path The directory to list (optional)
filespec File specification, may include wildcards (optional)
Switches:
/W Wide format (5 columns, filenames only)
Examples:
DIR List current directory
DIR *.TXT List all .TXT files
DIR /W List files in wide format
DIR D: List files on drive D:
DIR \DOS List files in \DOS directory
DIR C:\*.COM List all .COM files in root of C:
Output:
The listing shows:
- Volume label (if any)
- Directory path
- File names and sizes
- Subdirectories (marked with
)
- Total number of files and bytes
With /W switch, only file names are shown in a compact 5-column
format without size or date information.
Related commands: CD
-------------------------------------------------------------------------------
EDIT - Full-Screen Text Editor
-------------------------------------------------------------------------------
Opens a full-screen text editor for creating and editing text files.
Syntax:
EDIT [filename]
Parameters:
filename Optional file to open for editing
Screen Layout:
The editor uses a colored display:
- Top row: Menu bar (File, Edit, Search) and current filename
- Middle rows: Text editing area (white text on blue background)
- Bottom row: Status bar showing line number, column, and
modified indicator
Menu Access:
Alt+F Open File menu (New, Open, Save, Save As, Exit)
Alt+E Open Edit menu (Cut, Copy, Paste)
Alt+S Open Search menu (Find, Find Next)
Navigate menus with arrow keys. Press Enter to select an item
or Escape to close the menu.
Keyboard Shortcuts:
Ctrl+N New file
Ctrl+O Open file
Ctrl+S Save file
Ctrl+F Find
F3 Find Next (repeat last search)
Ctrl+X Cut line
Ctrl+C Copy line
Ctrl+V Paste
Alt+X Exit editor
Navigation:
Arrow keys Move cursor
Home Move to beginning of line
End Move to end of line
Page Up Scroll up one page
Page Down Scroll down one page
Ctrl+Home Move to beginning of file
Ctrl+End Move to end of file
Editing:
Backspace Delete character before cursor
Delete Delete character at cursor
Enter Insert new line
Tab Insert spaces to next tab stop
Clipboard Operations (Edit menu):
Cut Copy current line to clipboard and delete it
Copy Copy current line to clipboard
Paste Insert clipboard contents at cursor
Examples:
EDIT Open editor with empty file
EDIT README.TXT Open README.TXT for editing
EDIT NEWFILE.TXT Create and edit a new file
Notes:
- EDIT is an external command; EDIT.COM must be available in the
current directory or in C:\DOS\.
- Maximum file size is limited by available conventional memory.
- Files are saved with CR+LF line endings.
- Lines longer than 80 characters are truncated on display.
Related commands: TYPE, MORE
-------------------------------------------------------------------------------
ERASE - Delete File
-------------------------------------------------------------------------------
Identical to DEL. See DEL for details.
-------------------------------------------------------------------------------
EXIT - Exit Command Interpreter
-------------------------------------------------------------------------------
Terminates the command interpreter (COMMAND.COM).
Syntax:
EXIT
Parameters:
None
Notes:
- If COMMAND.COM was started by another program, EXIT returns to
that program.
- If EXIT is typed at the initial DOS prompt, results may vary
depending on system configuration.
WARNING: Do not type EXIT at the main system prompt unless you
understand the consequences.
-------------------------------------------------------------------------------
HEXDUMP - Display Hex Dump
-------------------------------------------------------------------------------
Displays a hexadecimal dump of a binary file.
Syntax:
HEXDUMP filename
Parameters:
filename The file to display
Examples:
HEXDUMP COMMAND.COM
HEXDUMP PROGRAM.EXE
Output:
Each line shows:
- Hexadecimal offset from start of file
- 16 bytes in hexadecimal format
- ASCII representation (non-printable characters shown as ".")
Notes:
- HEXDUMP is an external command; HEXDUMP.COM must be available.
- Handles files larger than 64KB.
- Useful for examining binary files, debugging, and data recovery.
Related commands: TYPE
-------------------------------------------------------------------------------
JMP - Execute Code at Memory Address
-------------------------------------------------------------------------------
Performs a far call to a flat 20-bit real-mode memory address, transferring
CPU execution to whatever code lives there. Completes the PEEK/POKE/JMP
trio for direct memory manipulation.
The target address is called (not jumped to), meaning code at that address
can return to DOS cleanly by executing a far return (RETF instruction). If
the target code never returns — because it jumps elsewhere, resets the
machine, or calls INT 20h — JMP.COM simply never returns either.
Syntax:
JMP address
Parameters:
address Flat memory address in hex with h suffix, up to 5 digits.
Range: 0h to FFFFFh.
Examples:
JMP FFFF0h Call BIOS cold-reset vector — resets the machine
JMP 100h Execute code at 0010:0000
Entry state seen by called code:
CS:IP = target address
SS:SP = JMP.COM stack; return address on top (use RETF to return)
DS,ES = JMP.COM data segment
Registers AX-DI: undefined — target should not rely on any value
Notes:
- JMP is an external command; JMP.COM must be available in the current
directory or in C:\DOS\.
- The primary workflow is: use POKE to write machine code into a scratch
area of RAM, then use JMP to execute it. This gives you an inline
code execution capability from the command line.
- JMP FFFF0h is a reliable way to cold-reset the machine — it calls
the BIOS reset entry point directly, the same vector the CPU jumps
to on power-on.
- If called code returns via RETF, JMP.COM exits to DOS normally.
If called code calls INT 20h or INT 21h AH=4Ch, the process
terminates and DOS gets control back either way.
WARNING: Jumping to an address that contains garbage or random data will
crash the system immediately. Always know what is at an address before
jumping to it. Use PEEK and HEXDUMP to inspect memory first.
Related commands: PEEK, POKE
-------------------------------------------------------------------------------
MD - Make Directory
-------------------------------------------------------------------------------
Creates a new directory.
Syntax:
MD dirname
MKDIR dirname
Parameters:
dirname The name of the new directory
Examples:
MD DOCS
MKDIR BACKUPS
Notes:
- MD and MKDIR are identical commands.
- The parent directory must already exist.
- Wildcard characters are not supported.
Related commands: CD
-------------------------------------------------------------------------------
MEM - Display Memory Information
-------------------------------------------------------------------------------
Displays comprehensive system memory information.
Syntax:
MEM [switches]
Switches:
/H Display help text
/B Show conventional memory blocks (MCB chain)
/U Show upper memory blocks (UMB chain)
/F Show HMA (High Memory Area) blocks
/D Show device drivers
/S Show system structures
/M Show system memory map with ASCII visualization
/A Show all information (combines all modes)
/P Pause listing at each page (23 lines)
Examples:
MEM Display memory summary
MEM /B Show conventional memory blocks
MEM /M Show memory map with visualization
MEM /A Show all available information
MEM /A /P Show all information with paging
Output:
The default output shows a summary table with:
- Conventional memory (0-640KB)
- High memory area (HMA)
- Extended memory (XMS)
- Total memory available
Additional switches provide detailed block-by-block information
including owner, size, and memory visualization.
Notes:
- MEM is an external command; MEM.COM must be available.
- Switches can be combined (e.g., MEM /B /U /P)
- The /M switch provides an ASCII art visualization of the entire
memory map.
- Very useful for diagnosing memory issues and understanding
system configuration.
Related commands: None
-------------------------------------------------------------------------------
MORE - Display Output One Page at a Time
-------------------------------------------------------------------------------
Displays a text file one page at a time, pausing after each screenful.
Syntax:
MORE filename
command | MORE
Parameters:
filename The file to display
Controls:
Space Display next page (23 lines)
Enter Display next line
Q or Esc Quit
Examples:
MORE README.TXT
TYPE BIGFILE.TXT | MORE
DIR | MORE
MEM /A | MORE
Notes:
- MORE is an external command; MORE.COM must be available in the
current directory or in C:\DOS\.
- When used with piping (|), the output of the preceding command
is displayed one page at a time.
- The "-- More --" prompt appears at the bottom of each page.
- Use TYPE for quick viewing of short files; use MORE for long files.
Related commands: TYPE
-------------------------------------------------------------------------------
MOUSE - PS/2 Mouse Driver
-------------------------------------------------------------------------------
Loads a resident PS/2 mouse driver that provides the standard INT 33h
mouse API used by DOS applications and games.
Syntax:
MOUSE
Parameters:
None
Examples:
MOUSE
Load the mouse driver before running applications that require
mouse support (e.g., games, editors, menu-driven programs).
Output:
If a PS/2 mouse is detected, the driver installs itself as a
Terminate-and-Stay-Resident (TSR) program and displays:
DR DOS 9.0 PS/2 Mouse Driver v1.0
Mouse detected - driver installed.
If no PS/2 mouse is detected, the driver displays an error and
exits without going resident.
Mouse Cursor:
Applications control the mouse cursor through INT 33h calls. In
text mode, the cursor appears as an inverse-video block character.
Notes:
- MOUSE is an external command; MOUSE.COM must be available in the
current directory or in C:\DOS\.
- The driver uses BIOS INT 15h PS/2 pointing device services for
hardware access. A PS/2-compatible mouse (or emulation) is required.
- Once loaded, the driver remains in memory. Reboot to unload.
- Load MOUSE before starting any application that needs mouse input.
Related commands: None
-------------------------------------------------------------------------------
MKDIR - Make Directory
-------------------------------------------------------------------------------
Identical to MD. See MD for details.
-------------------------------------------------------------------------------
MOVE - Move Files
-------------------------------------------------------------------------------
Moves a file from one location to another, removing the original.
Syntax:
MOVE source destination
Parameters:
source The file to move
destination The target filename or directory
Examples:
MOVE OLD.TXT NEW.TXT
MOVE C:\DOCS\FILE.TXT D:\BACKUP\
MOVE *.BAK D:\ARCHIVE\
Notes:
- MOVE is an external command; MOVE.COM must be available.
- If the destination file exists, MOVE will prompt before
overwriting.
- Enter Y for yes, N for no, or A for all to overwrite all
remaining files without prompting.
- MOVE supports wildcard characters in the source filespec.
Related commands: COPY
-------------------------------------------------------------------------------
PEEK - Read Byte from Memory Address
-------------------------------------------------------------------------------
Reads a single byte from any flat real-mode memory address and displays
it as two uppercase hex digits. Addresses span the full 20-bit real-mode
address space (0h through FFFFFh), giving direct access to conventional
memory, video RAM, the BIOS data area, and the interrupt vector table.
Syntax:
PEEK address
Parameters:
address Flat memory address in hex with h suffix (e.g. B8000h).
Up to 5 hex digits. Range: 0h to FFFFFh.
Examples:
PEEK 0h Read first byte of interrupt vector table
PEEK 46Ch Read low byte of BIOS timer tick counter
PEEK B8000h Read first character byte of text video RAM
PEEK A0000h Read first byte of VGA graphics framebuffer
Output:
A two-digit uppercase hex value followed by a newline:
FF
Notes:
- PEEK is an external command; PEEK.COM must be available in the
current directory or in C:\DOS\.
- Addresses are entered in hexadecimal with an h suffix. No 0x prefix
is used. Both uppercase and lowercase hex digits are accepted.
- The full 1 MB real-mode address space is accessible. There is no
memory protection; any address may be read.
- See the PC memory map below for notable addresses.
PC Memory Map (selected addresses):
0h - 3FFh Interrupt vector table (256 vectors x 4 bytes)
400h - 4FFh BIOS data area (equipment flags, cursor, etc.)
46Ch BIOS timer tick counter low word
472h Warm boot flag (1234h = warm boot)
B8000h - BFFFFh CGA/VGA text mode video RAM
A0000h - AFFFFh VGA graphics framebuffer (mode 13h, etc.)
B0000h - B7FFFh Monochrome display adapter RAM
C0000h - EFFFFh ROM space (video BIOS, adapter ROMs)
F0000h - FFFFFh System BIOS ROM
Related commands: POKE, JMP, HEXDUMP
-------------------------------------------------------------------------------
POKE - Write Byte to Memory Address
-------------------------------------------------------------------------------
Writes a single byte to any flat real-mode memory address. Like PEEK,
addresses span the full 20-bit real-mode address space (0h through
FFFFFh). On success, prints "OK" unless suppressed with /S.
Syntax:
POKE address value [/S]
Parameters:
address Flat memory address in hex with h suffix (e.g. B8000h).
Up to 5 hex digits. Range: 0h to FFFFFh.
value Byte value to write, in hex with h suffix (e.g. FFh).
Range: 0h to FFh.
Switches:
/S Silent. Suppresses the "OK" confirmation message.
Examples:
POKE B8000h 41h Write 'A' to first character of text video RAM
POKE B8001h 1Fh Write bright-white-on-blue attribute byte
POKE B8001h 80h Set blink attribute on first character
POKE 46Ch 0h Reset BIOS timer low byte (sets clock toward midnight)
POKE 100h FFh /S Write silently, no output
Notes:
- POKE is an external command; POKE.COM must be available in the
current directory or in C:\DOS\.
- Addresses and values are entered in hexadecimal with an h suffix.
Both uppercase and lowercase hex digits are accepted.
- The /S switch may appear anywhere after the two required arguments.
WARNING: POKE has direct, unprotected access to all of physical memory.
Writing to the wrong address can crash the system immediately and
without any error message. There is no undo. In particular:
- Addresses 0h-3FFh are the interrupt vector table. Corrupting a
vector will cause a crash the next time that interrupt fires. The
hardware timer (INT 8h, vector at 20h-23h) fires approximately 18
times per second; corrupting it will crash the system within
milliseconds whether or not you are doing anything.
- Addresses 84h-87h hold the INT 21h (DOS API) vector. Corrupting
this causes a crash on the very next DOS call, which COMMAND.COM
makes constantly.
- ROM addresses (C0000h and above) cannot be written. The write will
silently have no effect.
Related commands: PEEK, JMP, HEXDUMP
-------------------------------------------------------------------------------
REBOOT - Restart System
-------------------------------------------------------------------------------
Restarts the computer.
Syntax:
REBOOT
Parameters:
None
Notes:
- REBOOT is an external command; REBOOT.COM must be available.
- All unsaved work will be lost.
- This performs a warm boot (restart) of the system.
WARNING: Save all work before using REBOOT.
-------------------------------------------------------------------------------
REN - Rename File
-------------------------------------------------------------------------------
Renames an existing file.
Syntax:
REN oldname newname
RENAME oldname newname
Parameters:
oldname The current name of the file
newname The new name for the file
Examples:
REN OLD.TXT NEW.TXT
RENAME LETTER.DOC LETTER.BAK
Notes:
- REN and RENAME are identical commands.
- Wildcard characters are not supported.
- The new name cannot already exist in the same directory.
Related commands: COPY
-------------------------------------------------------------------------------
RENAME - Rename File
-------------------------------------------------------------------------------
Identical to REN. See REN for details.
-------------------------------------------------------------------------------
RD - Remove Directory
-------------------------------------------------------------------------------
Removes an empty directory.
Syntax:
RD dirname
RMDIR dirname
Parameters:
dirname The directory to remove
Examples:
RD TEMP
RD C:\OLD\BACKUP
RMDIR EMPTY
Notes:
- RD and RMDIR are identical commands.
- The directory must be empty before it can be removed.
- You cannot remove the current directory.
- You cannot remove the root directory.
Related commands: MD, CD
-------------------------------------------------------------------------------
RMDIR - Remove Directory
-------------------------------------------------------------------------------
Identical to RD. See RD for details.
-------------------------------------------------------------------------------
TYPE - Display File Contents
-------------------------------------------------------------------------------
Displays the contents of a text file on screen.
Syntax:
TYPE filename
Parameters:
filename The file to display
Examples:
TYPE README.TXT
TYPE C:\DOCS\LETTER.DOC
Notes:
- TYPE is an external command; TYPE.COM must be available.
- Use TYPE only on text files. Binary files will display
meaningless characters.
- For long files, use TYPE filename | MORE to page through
the output one screen at a time.
Related commands: COPY, HEXDUMP, MORE
-------------------------------------------------------------------------------
VER - Display Version
-------------------------------------------------------------------------------
Displays the DR DOS version number.
Syntax:
VER
Parameters:
None
Output:
DR DOS 9.0
Copyright 2022-2026 Whitehorn Ltd. Co., All Rights Reserved
===============================================================================
REPORTING BUGS AND ISSUES
===============================================================================
DR DOS 9.0 is currently in beta testing. We appreciate your help in
making DR DOS better by reporting any issues you encounter.
During beta testing, you may experience bugs, crashes, system freezes,
filesystem corruption, or hardware and software compatibility issues.
These are expected during this phase of development, and your reports
help us identify and fix problems.
WHAT TO REPORT
Please report any of the following:
- System crashes or freezes
- Filesystem corruption or data loss
- Programs that don't run correctly
- Unexpected error messages
- Hardware or software incompatibilities
- Any behavior that seems incorrect or unusual
HOW TO REPORT A BUG
Send an email to: bugs@dr-dos.com
Please include the following information in your report:
1. Version and Revision
Run the VER command at the DOS prompt to see your version.
It will display something like "DR DOS 9.0 rev 80".
Include the complete version string in your report.
2. Hardware or Virtualization Environment
Examples:
- QEMU 10.2 on Windows 11
- VirtualBox 7.0 on Linux
- Intel Pentium II PC with 440LX chipset, 128MB RAM
- 86Box emulator
3. What You Were Doing
Describe the task you were performing when the issue occurred.
Examples:
- "I was installing Lotus 1-2-3"
- "I was playing Commander Keen Episode 1"
- "I was copying files from C: to D:"
4. What Happened
Describe what you saw on screen. Screenshots or photos are very
helpful if possible. Include any error messages exactly as shown.
5. Debug Logs (Optional)
Debug logs are only available if you installed the debug build
of DR DOS (boot16-debug.img.7z instead of boot16.img.7z).
If you're using the debug build, capture the COM1 serial output
(115200 baud, 8 data bits, no parity, 1 stop bit):
- QEMU: Add "-serial file:debug.log" to your command line
- VirtualBox: Enable serial port, set to "Raw File" mode
- Physical hardware: Serial cable at 115200 baud, 8-N-1
Most users run the release build and won't have debug logs.
That's perfectly fine - the description and screenshots above
are sufficient for most bug reports.
GETTING HELP
Website: https://www.dr-dos.com
Bug Reports: bugs@dr-dos.com
Check the website for documentation, updates, and known issues.
Thank you for helping us improve DR DOS!
===============================================================================
APPENDIX A: ERROR MESSAGES
===============================================================================
This appendix lists error messages you may encounter and their
meanings.
Bad command or file name
The command you typed is not a built-in command, and no program
with that name was found in the current directory or in C:\DOS\.
Solution: Check the spelling of the command. Verify that the
program file exists in the expected location.
File not found -
The file you specified does not exist.
Solution: Check the spelling of the filename. Use DIR to verify
the file exists in the expected location.
Invalid directory
The directory path you specified does not exist.
Solution: Check the spelling of the directory name. Use DIR to
see available directories.
Required parameter missing
A command requires a parameter that you did not provide.
Solution: Check the command syntax and provide all required
parameters.
Unable to create destination file
The system could not create the destination file.
Solution: Verify that the destination directory exists and that
the disk is not write-protected or full.
Read error
An error occurred while reading from the disk.
Solution: The disk may be damaged. Try the operation again. If
the problem persists, the disk may need to be replaced.
Write error
An error occurred while writing to the disk.
Solution: The disk may be full, write-protected, or damaged.
Check disk space and write-protect status.
Access denied -
You attempted to access a file that is protected.
Solution: The file may be read-only or in use by another program.
Clear the read-only attribute before attempting to modify the file.
Unable to create directory
The system could not create the directory.
Solution: Verify that the parent directory exists. The directory
you're trying to create must be inside an existing directory.
Duplicate file name or file not found
An error occurred while renaming a file.
Solution: The new name may already exist, or the old name does not
exist. Use DIR to verify the file names.
Overwrite (Yes/No/All)?
The destination file already exists during a MOVE operation.
Solution: Enter Y to overwrite this file, N to skip it, or A to
overwrite all remaining files without prompting.
Error moving file
An error occurred while moving a file.
Solution: Check the file names and ensure you have permission to
access both the source and destination files.
File not found
No files were found matching the specified pattern.
Solution: Check the filename or pattern. Use DIR to see available
files.
Invalid parameter
An invalid parameter was provided.
Solution: Check the command syntax and ensure all parameters are
valid.
Syntax: MOVE source destination
The MOVE command was called with incorrect syntax.
Solution: Check the MOVE command syntax and ensure you provide
both a source and destination.
===============================================================================
APPENDIX B: BATCH PROGRAMMING GUIDE
===============================================================================
This appendix is a comprehensive programmer's reference for writing batch
scripts in DR DOS. It covers all supported commands, flow control, variable
handling, file operations, and practical patterns.
WHAT IS A BATCH FILE?
A batch file is a plain text file with a .BAT extension containing a
sequence of commands executed line by line. Batch files automate
repetitive tasks, create simple installers, and build menus.
Create batch files with EDIT or any text editor. Each line contains one
command. Blank lines are ignored.
-------------------------------------------------------------------------------
COMMENTS: REM
-------------------------------------------------------------------------------
Use REM to add comments. Everything after REM on the line is ignored.
REM This is a comment
REM Author: John Smith
REM Last modified: February 2026
Comments document your script's purpose, explain complex logic, and
leave notes for future maintenance.
-------------------------------------------------------------------------------
DISPLAYING TEXT: ECHO
-------------------------------------------------------------------------------
ECHO displays messages to the screen.
ECHO Hello, World!
ECHO Installation complete.
ECHO.
ECHO. (with a period, no space) prints a blank line.
Echo State:
By default, each command is displayed before execution. Control this
with ECHO OFF and ECHO ON:
ECHO OFF
REM Commands below this line are not displayed
ECHO This message still appears
ECHO ON
REM Commands are displayed again
ECHO OFF suppresses command display but ECHO messages still appear.
Use ECHO alone (no argument) to display the current echo state.
-------------------------------------------------------------------------------
SUPPRESSING ECHO: @
-------------------------------------------------------------------------------
Prefix any command with @ to suppress its display for that line only.
@ECHO OFF
This is the standard first line of most batch files. The @ prevents
"ECHO OFF" from being displayed, and ECHO OFF prevents subsequent
commands from being displayed.
@REM This comment won't be displayed
@PAUSE
-------------------------------------------------------------------------------
WAITING FOR INPUT: PAUSE
-------------------------------------------------------------------------------
PAUSE halts execution and displays "Press any key to continue . . ."
until the user presses a key.
ECHO About to delete temporary files...
PAUSE
DEL *.TMP
Use PAUSE to give users time to read messages or confirm before
potentially destructive operations.
-------------------------------------------------------------------------------
LABELS AND GOTO
-------------------------------------------------------------------------------
Labels mark locations in your script. A label is a line beginning
with a colon followed by a name:
:START
:MENU
:END
Label names are case-insensitive. :START, :Start, and :start are
identical.
GOTO transfers execution to a label:
GOTO END
ECHO This line is never executed
:END
ECHO Script finished
Exiting Early with GOTO :EOF:
Use GOTO :EOF to exit the batch file immediately without needing
to define an :END label:
@ECHO OFF
IF "%1"=="" (
ECHO Missing parameter!
GOTO :EOF
)
ECHO Processing %1...
This is cleaner than jumping to a label at the end of the file.
Creating Loops:
Combine GOTO with labels to create loops:
:LOOP
ECHO Press any key to continue, or Ctrl+C to exit
PAUSE
GOTO LOOP
Organizing Code Sections:
@ECHO OFF
GOTO MAIN
:USAGE
ECHO Usage: INSTALL source
GOTO :EOF
:MAIN
IF "%1"=="" GOTO USAGE
ECHO Installing from %1...
COPY %1 C:\PROGRAM\
-------------------------------------------------------------------------------
CONDITIONAL EXECUTION: IF
-------------------------------------------------------------------------------
IF executes a command only when a condition is true.
Testing File Existence:
IF EXIST CONFIG.SYS ECHO Config file found
IF EXIST C:\DOS\MOUSE.COM MOUSE
IF EXIST checks whether a file exists. The command after the filename
executes only if the file is found.
Testing Device Names:
IF EXIST also works with device names like NUL and CON:
IF EXIST NUL ECHO Device support available
Since NUL is a built-in device, this always succeeds. This can be used
to verify batch file compatibility.
String Comparison:
IF "%1"=="HELP" GOTO SHOWHELP
IF "%1"=="" ECHO No parameter provided
Strings must be enclosed in double quotes. The comparison is
case-sensitive: "YES" does not equal "yes".
Tip: Always quote both sides when comparing parameters. If %1 is empty,
IF %1=="" becomes IF =="" which is a syntax error. Using IF "%1"==""
becomes IF ""=="" which works correctly.
Testing Exit Codes with ERRORLEVEL:
Programs return exit codes (0-255) when they finish. Use IF ERRORLEVEL
to test these codes and handle success or failure:
PROGRAM.EXE
IF ERRORLEVEL 1 ECHO Program failed!
IF ERRORLEVEL 0 ECHO Program succeeded!
IF ERRORLEVEL n is true if the exit code is GREATER THAN OR EQUAL TO n.
This means you must test higher values first:
MYAPP.EXE
IF ERRORLEVEL 3 GOTO FATAL_ERROR
IF ERRORLEVEL 2 GOTO SERIOUS_ERROR
IF ERRORLEVEL 1 GOTO MINOR_ERROR
ECHO Success!
GOTO :EOF
:MINOR_ERROR
ECHO Warning: minor issue detected
GOTO :EOF
:SERIOUS_ERROR
ECHO Error: something went wrong
GOTO :EOF
:FATAL_ERROR
ECHO FATAL: critical failure!
GOTO :EOF
Standard DOS Error Codes:
Programs return exit codes (also called error codes or return codes) that
indicate success or failure. These codes are accessible via ERRORLEVEL.
Code Meaning
---- ---------------------------------------------------------
0 Success - operation completed without error
1 General error - operation failed
2 File not found - specified file does not exist
3 Path not found - specified directory does not exist
4 Too many open files - system file handle limit reached
5 Access denied - file is read-only or in use
8 Insufficient memory - not enough RAM for operation
15 Invalid drive - drive letter does not exist
18 No more files - used internally by FindFirst/FindNext
DR DOS Command Exit Codes:
Built-in and external commands return these codes:
Command Success Failure Notes
-------- ------- ------- ------------------------------------
COPY 0 1 1 if source not found or write fails
DEL 0 1 1 if file not found or access denied
REN 0 1 1 if file not found or name exists
MD 0 1 1 if directory exists or path invalid
RD 0 1 1 if directory not empty or not found
CD 0 1 1 if directory not found
TYPE 0 1 1 if file not found
DIR 0 1 1 if path not found (not if no files)
MOVE 0 1 1 if source not found or move fails
EDIT 0 - Always returns 0
MEM 0 - Always returns 0
Testing Multiple Error Levels:
Remember that IF ERRORLEVEL n is true when the code is >= n. Always test
higher values first to distinguish between different error conditions:
MYAPP.EXE
IF ERRORLEVEL 5 GOTO ACCESS_DENIED
IF ERRORLEVEL 3 GOTO PATH_ERROR
IF ERRORLEVEL 2 GOTO FILE_ERROR
IF ERRORLEVEL 1 GOTO GENERAL_ERROR
ECHO Operation successful.
GOTO :EOF
:FILE_ERROR
ECHO Error: File not found.
GOTO :EOF
:PATH_ERROR
ECHO Error: Directory not found.
GOTO :EOF
:ACCESS_DENIED
ECHO Error: Access denied - check file permissions.
GOTO :EOF
:GENERAL_ERROR
ECHO Error: Operation failed.
Negating Conditions:
IF NOT reverses the condition:
IF NOT EXIST TEMP MD TEMP
IF NOT "%1"=="" GOTO PROCESS
IF NOT ERRORLEVEL 1 ECHO Success!
This creates the TEMP directory only if it doesn't exist, processes
only if a parameter was provided, or reports success if exit code is 0.
-------------------------------------------------------------------------------
PARAMETERS: %0 THROUGH %9
-------------------------------------------------------------------------------
Batch files accept up to 9 parameters from the command line, accessed
as %1 through %9. %0 contains the batch file's own name.
Example batch file GREET.BAT:
@ECHO OFF
ECHO Hello, %1!
ECHO This script is: %0
Running: GREET John
Output:
Hello, John!
This script is: GREET.BAT
Using Multiple Parameters:
BACKUP.BAT:
@ECHO OFF
IF "%1"=="" GOTO USAGE
IF "%2"=="" GOTO USAGE
ECHO Copying %1 to %2...
COPY %1 %2
ECHO Done.
GOTO :EOF
:USAGE
ECHO Usage: BACKUP source destination
Running: BACKUP README.TXT D:\BACKUP\README.TXT
Literal Percent Sign:
Use %% to include a literal percent sign:
ECHO Disk is 50%% full
Displays: Disk is 50% full
-------------------------------------------------------------------------------
SHIFT: ACCESSING MORE THAN 9 PARAMETERS
-------------------------------------------------------------------------------
SHIFT moves all parameters down by one position:
Before SHIFT: %0=SCRIPT %1=A %2=B %3=C %4=D
After SHIFT: %0=A %1=B %2=C %3=D %4=(empty)
This allows processing an unlimited number of parameters in a loop:
LISTALL.BAT - Display all parameters:
@ECHO OFF
:LOOP
IF "%1"=="" GOTO :EOF
ECHO Parameter: %1
SHIFT
GOTO LOOP
Running: LISTALL one two three four five six
Output:
Parameter: one
Parameter: two
Parameter: three
Parameter: four
Parameter: five
Parameter: six
Processing Multiple Files:
DELALL.BAT - Delete all specified files:
@ECHO OFF
IF "%1"=="" GOTO USAGE
:LOOP
IF "%1"=="" GOTO DONE
IF EXIST %1 DEL %1
IF EXIST %1 ECHO Failed to delete: %1
IF NOT EXIST %1 ECHO Deleted: %1
SHIFT
GOTO LOOP
:DONE
ECHO All files processed.
GOTO :EOF
:USAGE
ECHO Usage: DELALL file1 file2 file3 ...
Note: After SHIFT, the original %0 (script name) is lost. Save it to
a variable first if needed.
-------------------------------------------------------------------------------
ENVIRONMENT VARIABLES: %VARNAME%
-------------------------------------------------------------------------------
Access environment variables by surrounding the name with percent signs:
ECHO Command interpreter: %COMSPEC%
ECHO Current path: %PATH%
If the variable doesn't exist, the text is left unchanged:
ECHO Value is: %UNDEFINED%
Output: Value is: %UNDEFINED%
Using Variables in Conditions:
IF "%COMSPEC%"=="" ECHO COMSPEC not defined!
IF NOT "%PATH%"=="" ECHO PATH is set
Displaying Environment Variables with SET:
Use SET with no arguments to display all environment variables:
SET
Use SET with a prefix to show only matching variables:
SET P Show variables starting with P
SET COM Show variables starting with COM
Note: SET displays environment variables but cannot modify them.
-------------------------------------------------------------------------------
CALLING OTHER BATCH FILES: CALL
-------------------------------------------------------------------------------
Use CALL to execute another batch file and return to continue:
@ECHO OFF
ECHO Starting installation...
CALL SETUP.BAT
ECHO Setup complete, running configuration...
CALL CONFIG.BAT %1
ECHO All done!
Without CALL, executing a batch file transfers control permanently
and does not return to the calling script.
Passing Parameters:
Parameters passed to CALL are available in the called script:
MAIN.BAT:
@ECHO OFF
CALL HELPER.BAT first second
HELPER.BAT:
@ECHO OFF
ECHO Received: %1 and %2
Running MAIN.BAT outputs:
Received: first and second
Nested Calls:
Batch files can call other batch files that call others:
MAIN.BAT -> CALL INIT.BAT -> CALL CHECK.BAT -> returns -> returns
Each CALL remembers where to return. Deep nesting may exhaust memory.
-------------------------------------------------------------------------------
FILE OPERATIONS
-------------------------------------------------------------------------------
Batch files include built-in commands for common file operations.
COPY - Copy Files:
COPY README.TXT BACKUP.TXT
COPY %1 %2
COPY *.DOC D:\BACKUP\
DEL / ERASE - Delete Files:
DEL TEMP.TXT
DEL *.BAK
ERASE OLD.DAT
Wildcards (* and ?) are supported.
REN / RENAME - Rename Files:
REN OLDNAME.TXT NEWNAME.TXT
RENAME %1 %2
MD / MKDIR - Create Directories:
MD NEWDIR
MKDIR C:\PROGRAMS\MYAPP
IF NOT EXIST TEMP MD TEMP
RD / RMDIR - Remove Directories:
RD EMPTYDIR
RMDIR C:\OLD\TEMP
The directory must be empty.
CD / CHDIR - Change Directory:
CD \
CHDIR C:\DOS
CD ..
Changes the current directory for subsequent commands.
-------------------------------------------------------------------------------
OUTPUT REDIRECTION
-------------------------------------------------------------------------------
Redirect command output to a file using >:
DIR > FILELIST.TXT
ECHO Installation log > INSTALL.LOG
MEM > MEMINFO.TXT
The file is created or overwritten.
Discarding Output with NUL:
Redirect to NUL to discard unwanted output:
DEL *.TMP > NUL
COPY FILE.DAT BACKUP.DAT > NUL
This suppresses success messages while still showing errors.
Note: Input redirection (<) and append redirection (>>) are not supported.
-------------------------------------------------------------------------------
PRACTICAL PATTERNS
-------------------------------------------------------------------------------
Standard Script Header:
@ECHO OFF
REM =============================================
REM SCRIPTNAME.BAT - Brief description
REM Author: Your Name
REM Date: February 2026
REM =============================================
Parameter Validation:
@ECHO OFF
IF "%1"=="" GOTO USAGE
IF "%2"=="" GOTO USAGE
REM ... main script logic ...
GOTO :EOF
:USAGE
ECHO Usage: %0 source destination
ECHO.
ECHO Copies source file to destination.
Error Handling with ERRORLEVEL:
@ECHO OFF
ECHO Compiling program...
COMPILER.EXE %1
IF ERRORLEVEL 1 GOTO FAILED
ECHO Compilation successful!
GOTO :EOF
:FAILED
ECHO Compilation failed with errors.
Cleanup on Exit:
@ECHO OFF
ECHO Creating temporary files...
COPY %1 TEMP.DAT
REM ... do work ...
ECHO Cleaning up...
DEL TEMP.DAT
ECHO Done.
Installer Pattern:
@ECHO OFF
ECHO ================================
ECHO MyProgram Installation
ECHO ================================
ECHO.
REM Check for required parameter
IF "%1"=="" GOTO USAGE
REM Create installation directory
IF NOT EXIST C:\MYAPP MD C:\MYAPP
REM Copy files
ECHO Copying files...
COPY %1\*.* C:\MYAPP\ > NUL
IF ERRORLEVEL 1 GOTO FAILED
ECHO.
ECHO Installation complete!
ECHO Run C:\MYAPP\MYAPP.EXE to start.
GOTO :EOF
:FAILED
ECHO Installation failed!
GOTO :EOF
:USAGE
ECHO Usage: INSTALL sourcedir
Conditional Setup:
@ECHO OFF
IF NOT EXIST C:\GAMES MD C:\GAMES
IF EXIST C:\GAMES\GAME.EXE GOTO RUN
ECHO Game not installed.
GOTO :EOF
:RUN
C:\GAMES\GAME.EXE
Processing Multiple Files with Wildcards:
Use wildcards to operate on groups of files:
@ECHO OFF
ECHO Deleting all backup files...
DEL *.BAK
DEL *.TMP
DEL *.OLD
ECHO Done.
Using CALL for Modular Scripts:
MAIN.BAT:
@ECHO OFF
CALL INIT.BAT
IF ERRORLEVEL 1 GOTO FAILED
CALL PROCESS.BAT %1
IF ERRORLEVEL 1 GOTO FAILED
CALL CLEANUP.BAT
ECHO Success!
GOTO :EOF
:FAILED
ECHO An error occurred.
-------------------------------------------------------------------------------
DEBUGGING TIPS
-------------------------------------------------------------------------------
Remove @ECHO OFF Temporarily:
Comment out or remove @ECHO OFF to see each command as it executes:
REM @ECHO OFF
IF "%1"=="" GOTO USAGE
...
This shows exactly what the batch file is doing.
Add Progress Messages:
ECHO DEBUG: About to copy files...
COPY %1 %2
IF ERRORLEVEL 1 ECHO DEBUG: Copy FAILED
IF NOT ERRORLEVEL 1 ECHO DEBUG: Copy successful
Use PAUSE for Breakpoints:
ECHO About to delete files - press Ctrl+C to abort
PAUSE
DEL *.TMP
Check Variable Values:
ECHO Parameter 1 is: [%1]
ECHO Parameter 2 is: [%2]
Brackets make it easy to spot empty or whitespace values.
-------------------------------------------------------------------------------
QUICK REFERENCE
-------------------------------------------------------------------------------
Flow Control:
------------------ --------------------------------------------------
REM text Comment (ignored)
ECHO message Display message
ECHO. Display blank line
ECHO OFF Stop displaying commands
ECHO ON Resume displaying commands
@command Execute without displaying this line
PAUSE Wait for keypress
:label Define a label (target for GOTO)
GOTO label Jump to label
GOTO :EOF Exit batch file immediately
CALL file [args] Execute batch file and return
Conditionals:
------------------ --------------------------------------------------
IF EXIST file cmd Execute cmd if file exists
IF NOT EXIST file cmd Execute cmd if file doesn't exist
IF ERRORLEVEL n cmd Execute cmd if exit code >= n
IF NOT ERRORLEVEL n Execute cmd if exit code < n
IF "a"=="b" cmd Execute cmd if strings match
IF NOT "a"=="b" cmd Execute cmd if strings differ
Variables:
------------------ --------------------------------------------------
%0 Batch file name
%1 - %9 Command line parameters
%% Literal percent sign
%VARNAME% Environment variable value
SHIFT Shift parameters left
SET Display all environment variables
SET prefix Display variables starting with prefix
File Operations:
------------------ --------------------------------------------------
COPY src dest Copy a file
DEL file Delete a file (also: ERASE)
REN old new Rename a file (also: RENAME)
MD dir Create directory (also: MKDIR)
RD dir Remove directory (also: RMDIR)
CD path Change directory (also: CHDIR)
Redirection:
------------------ --------------------------------------------------
cmd > file Redirect output to file
cmd > NUL Discard output
-------------------------------------------------------------------------------
EXAMPLE PROGRAMS
-------------------------------------------------------------------------------
This section provides complete, ready-to-use batch file examples that
demonstrate common tasks and techniques. All examples use only features
available in DR DOS.
Example 1: CLEANUP.BAT - Delete Temporary Files
------------------------------------------------
Removes common temporary files from the current directory.
@ECHO OFF
REM =============================================
REM CLEANUP.BAT - Remove temporary files
REM =============================================
ECHO Cleaning up temporary files...
ECHO.
IF EXIST *.TMP DEL *.TMP
IF EXIST *.BAK DEL *.BAK
IF EXIST *.OLD DEL *.OLD
ECHO Cleanup complete.
Example 2: BACKUP.BAT - Backup Files to Another Directory
----------------------------------------------------------
Copies important files to a backup directory, creating it if needed.
@ECHO OFF
REM =============================================
REM BACKUP.BAT - Backup files to D:\BACKUP
REM Usage: BACKUP filename
REM =============================================
IF "%1"=="" GOTO USAGE
REM Create backup directory if it doesn't exist
IF NOT EXIST D:\BACKUP MD D:\BACKUP
REM Check if source file exists
IF NOT EXIST %1 GOTO NOTFOUND
ECHO Backing up %1 to D:\BACKUP...
COPY %1 D:\BACKUP
IF ERRORLEVEL 1 GOTO FAILED
ECHO Backup successful.
GOTO :EOF
:NOTFOUND
ECHO ERROR: File %1 not found.
GOTO :EOF
:FAILED
ECHO ERROR: Backup failed.
GOTO :EOF
:USAGE
ECHO Usage: BACKUP filename
ECHO.
ECHO Copies the specified file to D:\BACKUP directory.
Example 3: INSTALL.BAT - Simple Installer
------------------------------------------
Installs a program to a target directory with error checking.
@ECHO OFF
REM =============================================
REM INSTALL.BAT - Install MyProgram
REM Usage: INSTALL [source_dir]
REM =============================================
ECHO ================================
ECHO MyProgram Installation
ECHO ================================
ECHO.
REM Default source is current directory
IF "%1"=="" GOTO USE_CURRENT
IF NOT EXIST %1\MYAPP.EXE GOTO NOTFOUND
GOTO INSTALL
:USE_CURRENT
IF NOT EXIST MYAPP.EXE GOTO NOTFOUND
:INSTALL
ECHO Creating program directory...
IF NOT EXIST C:\MYAPP MD C:\MYAPP
ECHO Copying program files...
IF "%1"=="" GOTO COPY_CURRENT
COPY %1\MYAPP.EXE C:\MYAPP > NUL
GOTO CHECK_COPY
:COPY_CURRENT
COPY MYAPP.EXE C:\MYAPP > NUL
:CHECK_COPY
IF ERRORLEVEL 1 GOTO FAILED
ECHO.
ECHO Installation complete!
ECHO.
ECHO Run C:\MYAPP\MYAPP.EXE to start the program.
GOTO :EOF
:NOTFOUND
ECHO ERROR: MYAPP.EXE not found.
ECHO Please specify the source directory.
GOTO :EOF
:FAILED
ECHO ERROR: Installation failed.
Example 4: MENU.BAT - Simple Menu System
-----------------------------------------
Displays a menu and runs programs based on batch file parameter.
@ECHO OFF
REM =============================================
REM MENU.BAT - Main Menu
REM Usage: MENU [choice]
REM =============================================
:SHOW_MENU
CLS
ECHO.
ECHO ========================================
ECHO MAIN MENU
ECHO ========================================
ECHO.
ECHO 1. Run Directory Listing
ECHO 2. Display Memory Status
ECHO 3. Run Cleanup
ECHO 4. Exit to DOS
ECHO.
ECHO To select, type: MENU 1, MENU 2, MENU 3, or MENU 4
ECHO.
IF "%1"=="" GOTO :EOF
IF "%1"=="1" GOTO OPTION1
IF "%1"=="2" GOTO OPTION2
IF "%1"=="3" GOTO OPTION3
IF "%1"=="4" GOTO :EOF
ECHO Invalid choice: %1
GOTO :EOF
:OPTION1
DIR
PAUSE
GOTO :EOF
:OPTION2
MEM
PAUSE
GOTO :EOF
:OPTION3
CALL CLEANUP.BAT
PAUSE
GOTO :EOF
Example 5: DEPLOY.BAT - Multi-Step Deployment
----------------------------------------------
Demonstrates CALL, ERRORLEVEL checking, and multi-step operations.
@ECHO OFF
REM =============================================
REM DEPLOY.BAT - Deploy application files
REM Usage: DEPLOY source_dir target_dir
REM =============================================
IF "%1"=="" GOTO USAGE
IF "%2"=="" GOTO USAGE
ECHO Starting deployment...
ECHO Source: %1
ECHO Target: %2
ECHO.
REM Step 1: Validate source
ECHO Step 1: Validating source directory...
IF NOT EXIST %1 GOTO NO_SOURCE
REM Step 2: Create target
ECHO Step 2: Creating target directory...
IF NOT EXIST %2 MD %2
IF ERRORLEVEL 1 GOTO MKDIR_FAILED
REM Step 3: Backup existing files
ECHO Step 3: Backing up existing files...
IF EXIST %2\*.EXE COPY %2\*.EXE %2\BACKUP > NUL
REM Step 4: Copy new files
ECHO Step 4: Copying new files...
COPY %1\*.* %2 > NUL
IF ERRORLEVEL 1 GOTO COPY_FAILED
ECHO.
ECHO Deployment successful!
GOTO :EOF
:NO_SOURCE
ECHO ERROR: Source directory %1 not found.
GOTO :EOF
:MKDIR_FAILED
ECHO ERROR: Could not create directory %2.
GOTO :EOF
:COPY_FAILED
ECHO ERROR: File copy failed.
GOTO :EOF
:USAGE
ECHO Usage: DEPLOY source_dir target_dir
ECHO.
ECHO Copies all files from source to target directory.
Example 6: ALLPARAM.BAT - Process All Parameters with SHIFT
------------------------------------------------------------
Demonstrates using SHIFT to handle unlimited parameters.
@ECHO OFF
REM =============================================
REM ALLPARAM.BAT - Process all command-line parameters
REM Usage: ALLPARAM file1 file2 file3 ...
REM =============================================
IF "%1"=="" GOTO USAGE
ECHO Processing files...
ECHO.
:LOOP
IF "%1"=="" GOTO DONE
ECHO Checking: %1
IF EXIST %1 ECHO - File exists
IF NOT EXIST %1 ECHO - File NOT found
SHIFT
GOTO LOOP
:DONE
ECHO.
ECHO All parameters processed.
GOTO :EOF
:USAGE
ECHO Usage: ALLPARAM file1 file2 file3 ...
ECHO.
ECHO Checks each specified file and reports if it exists.
Example 7: SAFEDEL.BAT - Safe Delete with Confirmation
-------------------------------------------------------
Deletes files only after confirming they exist.
@ECHO OFF
REM =============================================
REM SAFEDEL.BAT - Delete file with safety checks
REM Usage: SAFEDEL filename
REM =============================================
IF "%1"=="" GOTO USAGE
IF NOT EXIST %1 GOTO NOTFOUND
ECHO File to delete: %1
ECHO.
ECHO Press any key to delete, or Ctrl+C to cancel...
PAUSE > NUL
DEL %1
IF ERRORLEVEL 1 GOTO FAILED
IF EXIST %1 GOTO FAILED
ECHO File deleted successfully.
GOTO :EOF
:NOTFOUND
ECHO File %1 does not exist.
GOTO :EOF
:FAILED
ECHO ERROR: Could not delete %1.
GOTO :EOF
:USAGE
ECHO Usage: SAFEDEL filename
ECHO.
ECHO Deletes the specified file after confirmation.
Example 8: DIRLOG.BAT - Save Directory Listing
-----------------------------------------------
Saves a directory listing to a text file for later reference.
@ECHO OFF
REM =============================================
REM DIRLOG.BAT - Save directory listing to file
REM Usage: DIRLOG [directory]
REM =============================================
IF "%1"=="" GOTO CURRENT
IF NOT EXIST %1 GOTO NOTFOUND
CD %1
:CURRENT
ECHO Saving directory listing...
DIR > DIRLIST.TXT
ECHO Directory saved to DIRLIST.TXT
ECHO.
ECHO Contents:
TYPE DIRLIST.TXT
GOTO :EOF
:NOTFOUND
ECHO Directory %1 not found.
Example 9: RUNAPP.BAT - Run Application with Setup
---------------------------------------------------
Sets up the environment before running a program.
@ECHO OFF
REM =============================================
REM RUNAPP.BAT - Run application with setup
REM =============================================
ECHO Setting up environment...
REM Ensure required directories exist
IF NOT EXIST C:\TEMP MD C:\TEMP
IF NOT EXIST C:\APP\DATA MD C:\APP\DATA
REM Change to application directory
CD C:\APP
REM Run the application
ECHO Starting application...
MYAPP.EXE
REM Check exit status
IF ERRORLEVEL 1 GOTO ERROR
ECHO Application completed normally.
GOTO :EOF
:ERROR
ECHO Application exited with an error.
Example 10: DAILY.BAT - Daily Maintenance Tasks
------------------------------------------------
Combines multiple maintenance operations into one script.
@ECHO OFF
REM =============================================
REM DAILY.BAT - Daily system maintenance
REM Run this batch file once per day
REM =============================================
ECHO ========================================
ECHO Daily Maintenance Starting
ECHO ========================================
ECHO.
REM Step 1: Clean temporary files
ECHO Step 1: Cleaning temporary files...
CD C:\TEMP
IF EXIST *.TMP DEL *.TMP
IF EXIST *.BAK DEL *.BAK
CD \
REM Step 2: Create backup directory with today's files
ECHO Step 2: Backing up important files...
IF NOT EXIST D:\DAILY MD D:\DAILY
IF EXIST C:\DOCS\*.DOC COPY C:\DOCS\*.DOC D:\DAILY > NUL
REM Step 3: Report completion
ECHO.
ECHO ========================================
ECHO Maintenance Complete
ECHO ========================================
ECHO.
ECHO Temporary files cleaned.
ECHO Documents backed up to D:\DAILY.
-------------------------------------------------------------------------------
LIMITATIONS
-------------------------------------------------------------------------------
The following features are NOT supported in DR DOS batch files:
- FOR loops (FOR %%v IN (set) DO command)
- SET variable=value (setting variables)
- Input redirection (<)
- Append redirection (>>)
- Pipes within batch files
- Command extensions (/? help)
- Delayed variable expansion
- CHOICE command for menus
===============================================================================
GLOSSARY
===============================================================================
Batch file
A text file with a .BAT extension containing commands to be
executed in sequence. Used for automation and scripting.
Boot
The process of starting up a computer and loading the operating
system.
CHS
Cylinder-Head-Sector. A method of addressing disk sectors using
the physical geometry of the drive. Common on systems before 1994.
DR DOS fully supports CHS disk addressing.
Command interpreter
The program (COMMAND.COM) that displays the DOS prompt and
executes your commands.
Command prompt
The text displayed by DOS (e.g., C:\>) indicating it is ready
to accept a command.
Conventional memory
The first 640KB of memory, directly accessible by DOS programs.
This is the primary memory space for running programs.
Current directory
The directory where DOS looks for files by default. Displayed
in the command prompt.
Device
A hardware component or pseudo-device accessible through a
reserved name. DOS devices include CON (console), NUL (null
device), AUX (auxiliary), and PRN (printer).
Directory
A container for files and other directories, used to organize
the contents of a disk.
Drive
A device that reads and writes data to storage media. Identified
by a letter (C:, D:, etc.).
EMS
Expanded Memory Specification. A standard for accessing memory
beyond 640KB through a page-mapped window. DR DOS includes a
built-in LIM EMS 4.0 compatible driver.
Environment variable
A named value stored in the system environment, accessible to
programs and batch files. Examples: COMSPEC, PATH.
ERRORLEVEL
The exit code returned by a program when it finishes. Used in
batch files with IF ERRORLEVEL to test for success or failure.
Extension
The part of a filename after the period, typically indicating
the file type. Limited to 3 characters.
External command
A command that exists as a separate program file (.COM or .EXE)
rather than being built into COMMAND.COM.
FAT16
File Allocation Table (16-bit). The filesystem used by DR DOS
to organize files on disk.
File
A named collection of data stored on disk.
HMA
High Memory Area. The first 64KB of extended memory (minus 16
bytes), accessible in real mode. Used by DR DOS to load part
of the kernel, freeing conventional memory.
Internal command
A command built into COMMAND.COM, always available without
needing a separate program file.
LBA
Logical Block Addressing. A method of addressing disk sectors
using a linear block number. Common on systems from 1994 onward.
DR DOS fully supports LBA disk addressing.
NUL
A special device that discards all output written to it and
returns empty input when read. Useful for suppressing output:
command > NUL
Page frame
A 64KB window in upper memory (typically at segment D000h)
through which EMS expanded memory pages are accessed.
Parameter
Information provided to a command that modifies its behavior.
Path
The complete specification of a file's location, including
drive, directories, and filename.
Redirection
Sending a command's output to a file instead of the screen,
using the > operator.
Root directory
The top-level directory on a disk, from which all other
directories branch.
Wildcard
A special character (* or ?) that matches multiple characters
in a filename, used to specify groups of files.
XMS
Extended Memory Specification. A standard for accessing extended
memory (above 1MB) on 286 and higher processors. DR DOS includes
a built-in XMS driver and uses XMS as backing store for EMS.
===============================================================================
END OF USER GUIDE
===============================================================================
WHITEHORN LTD. CO.
3963 S Highway 97 #214
Sand Springs, OK 74063
DR DOS is a registered trademark of Whitehorn Ltd. Co.
Copyright (c) 2022-2026 Whitehorn Ltd. Co.
All rights reserved.