We ❤️ Open Source
A community education resource
26 commands to get started with FreeDOS
DOScember spotlight: From ATTRIB to ZIP - A beginner-friendly tour through the most useful FreeDOS commands.
Read the entire DOScember series and boot into vintage computing.
It’s December, and that means it’s “DOScember.” If you don’t know DOS, it was a popular desktop operating system through the 1980s and into the 1990s. In 1994, several developers banded together to create FreeDOS, an open source version of DOS. Today, FreeDOS is a modern version of DOS that runs all your classic DOS applications.
You can download FreeDOS and run it on classic hardware, or in a virtual machine for that retrocomputing experience. But if you’re new to FreeDOS, you may be unfamiliar with how to navigate the DOS command line, or how to use the different programs that come with FreeDOS. To get you started, I’d like to share 26 of my favorite FreeDOS commands.
A is for ATTRIB
The ATTRIB program displays or changes a file’s attributes. An attribute can be one of four values: Hidden (H), System (S), Read-only (R), and Archive (A).
Files marked as Hidden don’t display in a directory listing. For example, suppose you want to “hide” a file called FILE.TXT in the FILES directory so no one would know it was there. First, you can show the attributes on that file to see its current settings:
C:\FILES>attrib FILE.TXT
[----A] FILE.TXT
To hide this file, turn on the Hidden attribute by using the plus (+) operator, like this:
C:\FILES>dir /w
Volume in drive C is FREEDOS
Volume Serial Number is 1B45-1A07
Directory of C:\FILES
[.] [..] FILE.TXT
1 file(s) 14 bytes
2 dir(s) 28,733,440 bytes free
C:\FILES>attrib +H FILE.TXT
[----A] -> [-H--A] FILE.TXT
C:\FILES>dir /w
Volume in drive C is FREEDOS
Volume Serial Number is 1B45-1A07
Directory of C:\FILES
[.] [..]
0 file(s) 0 bytes
2 dir(s) 28,733,440 bytes free
Another common way to use ATTRIB is by manipulating the Read-only attribute, so you don’t accidentally overwrite an important file. Suppose you want to protect the FILE.TXT file so you can’t delete or change it. Let’s turn off the Hidden attribute using -H, and turn on the Read-only attribute with the +R modifier. After that, we cannot accidentally delete the file:
C:\FILES>attrib -H +R FILE.TXT
[-H--A] -> [---RA] FILE.TXT
C:\FILES>del FILE.TXT
C:\FILES\FILE.TXT: Permission denied
no file removed.
B is for BEEP
If you need to add a little pizzazz to a batch file, you can use the BEEP command to get the user’s attention. BEEP doesn’t display anything to the screen, but simply generates a classic “beep” tone.
Note that BEEP uses the PC’s built-in speaker to make the “beep” sound. If you boot FreeDOS using a virtual machine, check that your system is set up to correctly emulate the PC speaker or you will not hear the beep.
C is for CD
Like Linux, FreeDOS supports directories, which allow you to organize your files in a way that makes sense to you. For example, you might keep all of your files in a directory called FILES, and you might create other directories inside FILES for certain kinds of files, such as DOCS for word processor files, or SPRDSHT for spreadsheet files.
You can make new directories with MKDIR or MD, and navigate into a directory using the CD or CHDIR. I prefer to use the same command syntax as Linux, so I use MKDIR and CD.
Let’s make a new directory for documents, and use the CD command to navigate there, and type DIR to see that the new directory is empty:
C:\FILES>mkdir DOCS
C:\FILES>cd DOCS
C:\FILES\DOCS>dir
Volume in drive C is FREEDOS
Volume Serial Number is 1B45-1A07
Directory of C:\FILES\DOCS
. <DIR> 12-13-2025 6:58p
.. <DIR> 12-13-2025 6:58p
0 file(s) 0 bytes
2 dir(s) 28,731,392 bytes free
You don’t have to navigate one directory at a time. You can instead provide the full directory path you want to navigate to, using one CD command. Here’s an example that shows the FreeDOS CPI files:
C:\FILES\DOCS>cd \freedos\cpi
C:\FREEDOS\CPI>dir /w
Volume in drive C is FREEDOS
Volume Serial Number is 1B45-1A07
Directory of C:\FREEDOS\CPI
[.] [..] EGA.CPX EGA10.CPX EGA11.CPX
EGA12.CPX EGA13.CPX EGA14.CPX EGA15.CPX EGA16.CPX
EGA17.CPX EGA18.CPX EGA2.CPX EGA3.CPX EGA4.CPX
EGA5.CPX EGA6.CPX EGA7.CPX EGA8.CPX EGA9.CPX
18 file(s) 119,461 bytes
2 dir(s) 28,731,392 bytes free
D is for DELTREE
If you need to delete a single file, you can use the DEL command. To remove an empty directory, you can use the RMDIR or RD commands. But what if you want to delete a directory that has lots of files and subdirectories inside it?A directory with other directories inside it is called a directory tree. You can delete an entire directory tree with the DELTREE command. For example, to delete a TEMP directory, which might contain unneeded temporary files, type this command:
C:\>deltree TEMP
[DEFAULT-BUILD v1.02g] of DELTREE. The "ROOT-SAFETY-CHECK" is enabled.
Delete directory "C:\TEMP"
and all its subdirectories?
[Y] [N] [Q], [ENTER] ? Y
==> Deleting "C:\TEMP" ...
You can easily and quickly wipe out a lot of work with a single DELTREE command, so the FreeDOS DELTREE prompts you to ask if this is really something you want to do. Use this command carefully.
E is for EDIT
If you need to edit a text file on FreeDOS, the EDIT program lets you do that quickly and easily. For example, to start editing a file called HELLO.TXT, type EDIT HELLO.TXT. If the HELLO.TXT file already exists, EDIT opens the file for editing. If HELLO.TXT doesn’t exist yet, then EDIT starts a new file for you.

FreeDOS EDIT uses a friendly interface that should be easy for most people to use. Use the menus to access the various features of EDIT, including saving a file, opening a new file, or exiting the editor. To access the menus, tap the Alt key on your keyboard, then use the arrow keys to get around and Enter to select an action.

F is for FIND
If you need to find text in a file, the FIND command does the job. Similar to grep on Linux but without regular expressions (which makes it more like grep -F) the FIND command prints lines that contain a string. For example, to print all lines in the FDCONFIG.SYS file that contain the string “MENU”, use FIND like this:
C:\>find "MENU" FDCONFIG.SYS
---------------- FDCONFIG.SYS
!MENUCOLOR=7,0
MENUDEFAULT=2,5
MENU 1 - Load FreeDOS with JEMMEX, no EMS (most UMBs), max RAM free
MENU 2 - Load FreeDOS with JEMMEX (more compatible)
MENU 3 - Load FreeDOS with JEMM386 (Expanded Memory)
MENU 4 - Load FreeDOS low with some drivers (Safe Mode)
MENU 5 - Load FreeDOS without drivers (Emergency Mode)
If you aren’t sure if the string you want to find uses uppercase or lowercase letters, add the /I option to ignore the letter case. Let’s try it to find the “MENUDEFAULT” line, whether or not it’s uppercase or lowercase:
C:\>find /I "menudefault" FDCONFIG.SYS
---------------- FDCONFIG.SYS
MENUDEFAULT=2,5
G is for GRAPHICS
If you want to print a screenshot, you might use the PrtScr (Print Screen) key on your keyboard to print the text on your monitor directly to a printer. However, this only works for plain text. If you want to print graphic screens, you need to load the GRAPHICS program.
GRAPHICS supports different printer types, including PostScript-compatible printers, HP PCL printers, and old-style Epson dot matrix printers. For example, if you have an HP laser printer connected to your computer, you can load GRAPHICS support for that printer by typing this command:
C:\>graphics HPDEFAULT
Running in MS GRAPHICS compatibility mode...
Using HPPCL type for type HPDEFAULT
If you think this is not correct, mail me (see help text).
Printing black as white and white as black
which internally uses /I of this GRAPHICS.
You can use the following command directly instead of
GRAPHICS [your options] in the future:
LH GRAPH-HP /I
Note that GRAPH-HP allows extra options:
/E economy mode, /1 use LPT1, /2 use LPT2, /3 use LPT3,
/R for random instead of ordered dither
/C for 300dpi instead of 600dpi
Driver to make 'shift PrtScr' key work
even in CGA, EGA, VGA, MCGA graphics
modes loaded, in HP PCL mode.
With DOS, it’s best to load drivers like this into upper memory with the LH or LOADHIGH command, so you can save more main or “conventional” memory for running programs. The GRAPHICS command output shows you what you can type the next time you boot your FreeDOS system to load support your printer:
LH GRAPH-HP /I
H is for HELP
If you’re new to FreeDOS, you can get hints on how to use the different commands by typing HELP. This brings up the FreeDOS Help system, with documentation on all the commands:

I is for IF
You can add conditional statements to your command line or batch file using the IF statement. IF makes a simple test, then executes a single command. For example, to print the result “It’s there” if a certain file exists, you can type:
C:\>if EXIST C:\files\FILE.TXT echo It's there
It's there
If you want to test the opposite, use the NOT keyword before the test. For example, to compare two strings and print the results value, type these commands:
C:\>if "A"=="A" echo Equal
Equal
C:\>if "A"=="B" echo ?
C:\>if NOT "A"=="B" echo Not equal
Not equal
J is for JOIN
Early DOS versions were fairly simple; the first version of DOS didn’t even support directories. To provide backwards compatibility for those older programs, we have the JOIN program as a neat workaround. JOIN replaces a path with a drive letter, so you can put an old program in its own subdirectory, but access it using a single drive letter.
Let’s say you had an old application that doesn’t understand directories. To use the legacy application but save your files in a C:\DOCS directory, you can “join” an unused drive letter to your C:\DOCS path. For example:
C:\>join Z: C:\DOCS
FreeDOS implements JOIN as SWSUBST, which also combines features from the similar SUBST command. To join the drive letter Z: to the C:\DOCS path, use the SWSUBST command like this:
C:\>dir Z:
File not found. - 'Z:'
C:\>swsubst Z: C:\DOCS
C:\>dir Z: /w
Volume in drive Z is FREEDOS
Volume Serial Number is 1B45-1A07
Directory of Z:\
[.] [..] REPORT.DOC
1 file(s) 10 bytes
2 dir(s) 28,727,296 bytes free
K is for KEYB
DOS assumes a US keyboard layout by default. If your keyboard is different, you can use the KEYB command to load a new keyboard language layout. For example, to load a German keyboard layout, type:
C:\>LH keyb DE
FreeDOS KEYB 2.10 - (c) Aitor Santamaria Merino - GNU GPL 2.0
Keyboard layout : C:\FREEDOS\BIN\KEYBOARD.SYS:DE [858] (3)
L is for LABEL
It used to be quite common to save your files on floppy disks. In the early days, floppies were typically 360 kB. Later floppies could store as much as 720 kB or 1.44 MB. With limited space, you might dedicate one floppy to store your documents and another floppy to keep temporary data, like files you might take with you to class or the office.
Floppies could be assigned a volume label to indicate what kind of files you might find there. Use the LABEL command to view or set a disk’s label. For example:
C:\>dir A: /w
Volume in drive A has no label
Volume Serial Number is 1F17-1CF6
Directory of A:\
[SAVED] [TEMP] [DOCS] [SPRDSHT]
0 file(s) 0 bytes
4 dir(s) 595,968 bytes free
C:\>label A: FILES
C:\>dir A: /w
Volume in drive A is FILES
Volume Serial Number is 1F17-1CF6
Directory of A:\
[SAVED] [TEMP] [DOCS] [SPRDSHT]
0 file(s) 0 bytes
4 dir(s) 595,968 bytes free
M is for MEM
Running programs and loading drivers takes memory. To see how much memory your system has, and how much memory is free for running DOS programs, use the MEM command:
C:\>mem
Memory Type Total Used Free
---------------- -------- -------- --------
Conventional 639K 21K 618K
Upper 0K 0K 0K
Reserved 385K 385K 0K
Extended (XMS) 7,040K 307K 6,733K
---------------- -------- -------- --------
Total memory 8,064K 713K 7,351K
Total under 1 MB 639K 21K 618K
Total Expanded (EMS) 7,440K (7,618,560 bytes)
Free Expanded (EMS) 6,736K (6,897,664 bytes)
Largest executable program size 618K (632,688 bytes)
FreeDOS is resident in the high memory area.
N is for NANSI
If you want to add a little color to the FreeDOS command line, you can use ANSI escape sequences. These sequences are so named because each starts with code 33 (the ESC code) and the [ character, followed by a special sequence of characters, terminated with m. Separate values with a semicolon (;). The codes are defined by the American National Standards Institute, or ANSI, such as ESC[37;44m to set white on blue, or ESC[1;37;44m to use bold (1 attribute) white on blue, and ESC[0m to reset text to default colors.
| Color | Text color | Background color |
| Black | 30 | 40 |
| Red | 31 | 41 |
| Green | 32 | 42 |
| Brown | 33 | 43 |
| Blue | 34 | 44 |
| Magenta | 35 | 45 |
| Cyan | 36 | 46 |
| White | 37 | 47 |
FreeDOS supports ANSI escape sequences through the NANSI.SYS driver. With NANSI loaded, your FreeDOS console interprets the ANSI escape sequences, such as setting the text colors.

O is for OpenWatcom
FreeDOS includes lots of developer tools, too. If you would like to explore programming, you might like to check out the compilers, debuggers, libraries, editors, and other development tools that we include on the BonusCD. You can find them under the “Development” group:

The OpenWatcom C compiler is an excellent C compiler with support for console and graphics programming to make more visually interesting programs. Note that OpenWatcom is quite “verbose” by default, so you should set the DOS4G variable to quiet so the DOS/4GW extender doesn’t print a banner, and use the -q (quiet) compiler option to suppress unnecessary output:
D:\SRC>set DOS4G=quiet
D:\SRC>wcl -q hello.c
D:\SRC>hello
Hello world
P is for PROMPT
The standard FreeDOS command-line prompt tells you where you are in the filesystem. When you first boot FreeDOS, your prompt looks like C:\>, which means the “\” (root) directory on the “C” drive. The “>” character indicates where you can type a command.
If you prefer different information on your prompt, use the PROMPT command to change it. You can represent different information with a special code preceded with $, such as $D for the date and $T for the time. Alternatively, you can make your FreeDOS command line look like a Linux prompt with the $$ instruction, to print a single dollar sign:
C:\>prompt $$
$
Type PROMPT /? to see a list of all special codes.
Q is for QBASIC
FreeDOS doesn’t actually have QBASIC. That was a proprietary BASIC programming environment for MS-DOS. Instead, we provide several open source compilers, including some for BASIC programming.
The FreeBASIC Compiler should compile most QBASIC programs out there. Here’s a simple “guess the number” example:
dim number as integer
dim guess as integer
randomize timer
number = int( 10 * rnd() ) + 1
print "Guess the number from 1 to 10:"
do
input guess
if guess < number then print "Too low"
if guess > number then print "Too high"
loop while guess <> number
print "That's right!"
Use the FBC command to compile the program with FreeBASIC:
C:\DEVEL\FBC>fbc guess.bas
Here’s a quick demonstration of that simple game:
C:\DEVEL\FBC>guess
Guess the number from 1 to 10:
? 5
Too high
? 3
Too low
? 4
That's right!
R is for REM
Comments are great when writing programs; comments help us understand what the program is supposed to do. You can do the same in batch files using the REM command. Anything after the REM is ignored in a batch file.
REM this is a comment
S is for SET
The FreeDOS command line uses a set of variables called environment variables that let you customize your system. You can set these variables with the SET command. For example, use the DIRCMD variable to control how DIR arranges directory listings. To set the DIRCMD variable, use the SET command:
SET DIRCMD=/O:GNE
This tells DIR to order (O) the output by grouping (G) directories first, then sorting the results by name (N) and extension (E).
T is for TYPE
The TYPE command is one of the most-often used DOS commands. TYPE displays the contents of a file, similar to cat on Linux.
C:\DEVEL>type hello.c
#include <stdio.h>
int main()
{
puts("Hello world");
return 0;
}
U is for UNZIP
On Linux, you may be familiar with the standard Unix archive command: tar. There’s a version of tar on FreeDOS too (and a bunch of other popular archive programs), but the standard DOS archiver is ZIP and UNZIP. Both are installed in FreeDOS by default.
Let’s say I had a zip archive of some files. If I want to extract the entire zip file, I could just use the UNZIP command with the zip file as a command-line option. That extracts the archive starting at my current working directory. Unless I’m restoring a previous version of something, I probably don’t want to overwrite my current files. In that case, I will want to extract the archive to a new directory. You can specify the destination path with the -d (“destination”) command-line option:
D:\SRC>unzip VP_BAK.ZIP -d \VP
Archive: VP_BAK.ZIP
creating: /VP/vp/
inflating: /VP/vp/readme
inflating: /VP/vp/vp.c
inflating: /VP/vp/build.bat
inflating: /VP/vp/clean.bat
extracting: /VP/vp/t.txt
inflating: /VP/vp/vp.obj
inflating: /VP/vp/vp.exe
inflating: /VP/vp/untab.c
inflating: /VP/vp/untab.obj
inflating: /VP/vp/67.txt
inflating: /VP/vp/untab.exe
inflating: /VP/vp/vp.sav
V is for VER
In the old days of DOS, the VER command reported the DOS distribution you were running, such as “MS-DOS 6.22” With FreeDOS, the VER command gives you additional details, such as the version of the FreeDOS Shell:
C:\>ver
FreeCom version 0.86 - WATCOMC - XMS_Swap [Dec 30 2024 22:10:51]
If you also want to see the FreeDOS kernel version and the DOS compatibility level, add the /R option:
C:\>ver /R
FreeCom version 0.86 - WATCOMC - XMS_Swap [Dec 30 2024 22:10:51]
DOS version 7.10
FreeDOS kernel 2043 (build 2043 OEM:0xfd) [compiled May 14 2021]
W is for WHICH
The FreeDOS command line can run programs from a list of different directories, identified in a PATH variable. You can use the WHICH command to identify exactly where a program is located. Just type WHICH plus the name of the program you want to locate:
C:\>which xcopy
xcopy C:\FREEDOS\BIN\XCOPY.EXE
X is for XCOPY
The COPY command copies only files from one place to another. If you want to extend the copy to include any directories, use the XCOPY command instead. I usually add the /E option to include all subdirectories, including empty ones, so I can copy the entire directory tree. This makes an effective backup of any project I am working on:
D:\SRC>xcopy /s FORTRAN FORTRAN.BAK
Does FORTRAN.BAK specify a file name
or directory name on the target (File/Directory)? D
Copying D:\SRC\FORTRAN\COUNT\CGOTO.F
Copying D:\SRC\FORTRAN\COUNT\AIF.F
Copying D:\SRC\FORTRAN\COUNT\AGOTO.F
Copying D:\SRC\FORTRAN\HELLO.F
Copying D:\SRC\FORTRAN\CHARSET.TXT
Copying D:\SRC\FORTRAN\COUNT.F
Copying D:\SRC\FORTRAN\COLUMNS.TXT
Copying D:\SRC\FORTRAN\LOOP.F
Copying D:\SRC\FORTRAN\VARS.F
Copying D:\SRC\FORTRAN\AREA.F
Copying D:\SRC\FORTRAN\TRAJ.F
Copying D:\SRC\FORTRAN\COMPLX.F
Copying D:\SRC\FORTRAN\ARRAY.F
Copying D:\SRC\FORTRAN\COLLATZ.F
Copying D:\SRC\FORTRAN\OVERFLOW.F
Copying D:\SRC\FORTRAN\INT.F
16 file(s) copied
This isn’t a command, but interesting trivia about how DOS displays colors. If you’ve looked carefully at FreeDOS, you’ve probably noticed that text only comes in a limited range of colors: sixteen text colors, and eight background colors.
Y is for Yellow
The IBM 5153 color display presented color to the user by lighting up tiny red, green, and blue phosphor dots at different brightness levels to create a palette of 16 text colors and 8 background colors. Early PCs could only display the background color in the “normal intensity” level; only text colors could use bright colors.
If you look at the text colors, you have black, blue, green, cyan, red, magenta, brown (also called orange), and white. The “bright” versions of these colors are bright black (a dull gray), bright blue, bright green, bright cyan, bright red, bright magenta, yellow, and bright white. The “bright” version of brown is actually yellow. There is no “bright brown” or “bright orange.”

Z is for ZIP
You can use ZIP at the DOS command line to create archives of files and directories. This is a handy way to make a backup copy of your work or to release a “package” to use in a future FreeDOS distribution. For example, let’s say I wanted to make a backup of my project source code; I could use ZIP with the -9 option to provide the best possible compression, and -r (recurse) to include all subdirectories. You can also combine the options, like -9r to to both:
D:\SRC>zip -9r FORTRAN.ZIP FORTRAN
adding: fortran/ (stored 0%)
adding: fortran/hello.f (deflated 23%)
adding: fortran/charset.txt (deflated 21%)
adding: fortran/count.f (deflated 26%)
adding: fortran/columns.txt (deflated 54%)
adding: fortran/loop.f (deflated 44%)
adding: fortran/vars.f (deflated 52%)
adding: fortran/area.f (deflated 34%)
adding: fortran/traj.f (deflated 39%)
adding: fortran/complx.f (deflated 28%)
adding: fortran/array.f (deflated 46%)
adding: fortran/collatz.f (deflated 46%)
adding: fortran/overflow.f (deflated 47%)
adding: fortran/count/ (stored 0%)
adding: fortran/count/cgoto.f (deflated 39%)
adding: fortran/count/aif.f (deflated 34%)
adding: fortran/count/agoto.f (deflated 42%)
adding: fortran/int.f (deflated 27%)
FreeDOS is a great way to experience the classic DOS operating system, but with more modern options and tools. Use the HELP command if you get lost, or type ? to see what shell commands you can use. The standard FreeDOS programs can be found in the C:\FREEDOS\BIN directory, which should already be in your PATH so you can just type commands at the prompt. To learn more, add the /? option after most commands to get more information, such as ATTRIB /? to learn how to use the ATTRIB command:
C:\FILES>attrib /?
ATTRIB v2.1 - Displays or changes file attributes.
Copyright (c) 1998-2003, licensed under GPL2.
Syntax: ATTRIB { options | [path][file] | /@[list] }
Options:
+H Sets the Hidden attribute. -H Clears the Hidden attribute.
+S Sets the System attribute. -S Clears the System attribute.
+R Sets the Read-only attribute. -R Clears the Read-only attribute.
+A Sets the Archive attribute. -A Clears the Archive attribute.
/S Process files in all directories in the specified path(es).
/D Process directory names for arguments with wildcards.
/@ Process files, listed in the specified file [or in stdin].
Examples:
attrib file -rhs
attrib +a -r dir1 dir2*.dat /s
attrib -hs/sd /@list.txt *.*
And that’s your DOScember ABCs, from ATTRIB to ZIP, with all the essential commands in between to make you feel right at home on the FreeDOS command line.
Read the entire DOScember series and boot into vintage computing.
More from We Love Open Source
- Turn off acceleration for an authentic retrocomputing experience
- Building As-Easy-As: A spreadsheet born out of scientific need
- How to write your first FreeDOS program
- How I run virtual machines with QEMU
- Why FreeDOS is a modern DOS
The opinions expressed on this website are those of each author, not of the author's employer or All Things Open/We Love Open Source.