MS-DOS Summary
A Survival Guide
Module Q02cd
Contents
Audience and Objectives
About this document...
Quick Reference
NOTE: Most concepts are explained in more detail below thequick reference
DOS Conventions:
- All DOS commands are activated by typing the commands andpressing the <Enter> key.
- DOS is not case-sensitive: commands and file namescan be written in either CAPITALS or lower-case letters - it makesno difference
- Spaces are the primary separators in DOS commands. One ormore space must follow each command word, and file names are delimitedby spaces. Therefore, file names may not contain spaces.
Return to Contents of this document
The DOS Prompt
To let you know it is ready to accept your commands, DOS displaysa "prompt" on the screen. This prompt can be set tobe just about anything, but 99% of the time it follows this standardformat:
Example: C:\WINDOWS\SYSTEM>
- C:
- the default disk drive
- \
- the root directory
- WINDOWS
- name of a subdirectory in the root
- SYSTEM
- name of a directory in the WINDOWS subdirectory
- >
- Ready for your command!
The prompt means that your command will affect files in the Systemdirectory under the Windows directory at the root of the C: drive,unless you specify a different path.
Return to Contents of this document
Getting and Interpreting File and Directory Listings
Listing a Directory:
- Simple:
- dir
- File:
- dir filename.typ
- All files with one extension:
- dir *.ext
- All files with one name:
- dir name.*
- Files the same except for one letter:
- dir nam?.ext
- All files in a specific directory
- dir c:\web\site\*.*
- Wide:
- dir /w
- Order by name:
- dir /o
- Include subdirectories:
- dir /s
- Send listing to printer:
- dir > prn
- Putting features together:
- dir *.ext /w /o /s > prn
Interpreting a Directory Listing:
- The Listing...
Volume in drive A is MINI_BOOT Volume Serial Number is 4106-18E9 Directory of A:\ COMMAND COM 52925 03-10-93 6:00a DEFRAG EXE 75033 03-10-93 6:00a DEFRAG HLP 9227 03-10-93 6:00a 3 file(s) 137185 bytes 1188352 bytes free
- The Details...
Volume in drive A is MINI_BOOT
Volume label can be given when formating a disk, or byusing the label command
Volume Serial Number is 4106-18E9
Serial number is assigned automatically when formatting
Directory of A:\
This disk is in A: drive, and we're looking at the "root"directory
COMMAND COM 52925 03-10-93 6:00a
This file is the DOS program that interprets your typed commands.
When giving commands dealing with this file, write it command.com(no spaces!)
This file occupies 52,925 bytes and was last modified 03-10-93at 6:00 AM.
DEFRAG EXE 75033 03-10-93 6:00a
This is a program that can be run by typing defragat the DOS prompt.
Executable DOS programs have extensions .com or.exe
DEFRAG HLP 9227 03-10-93 6:00a
This file probably has "on-line help" informationfor the Defrag program
3 file(s) 137185 bytes
There are three files occupying a total of 137,185 bytes inthis directory
1188352 bytes free
You could store another 1,188,352 bytes on this disk
A byte is enough space to hold one character(letter or symbol)
Return to Contents of this document
Using "Wildcard" Characters
DOS commands that deal with files allow you to specify files byname, or to approximate names by using special characters, calledwildcard characters, that match several file names.
Wildcards can be used just about any commands that deal with files:dir, copy, rename, xcopy, and more.
- Matching any group of letters:
- * (star, or asterisk) matches any group of lettersin the file name after the asterisk
- Matching any single letter:
- ? (question mark) matches any single letter in thefile name.
Examples:
- dir *.*
- List all files
- dir *.exe
- List all files with extension exe
- dir prog1.*
- List all files with the name prog1 regardless of theirextension
- dir q*.*
- List all files beginning with the letter q
- copy *.bat b:
- Copy all files with the extension .bat to drive b:
- dir budget?a.dat
- List files whose name begins with budget, has any singlecharacter, ends with a and has the extension .dat- for example,
budget1a.dat
budget2a.dat
budget3a.dat - dir ???????x.dat
- List files whose eighth character is an x and whoseextension is .dat. This will find abcdefgx.dat andhijklmnx.dat but not abcedfx.dat (where thereis an x but not in the eighth position).
Note 1: This will not work with * - for example,if you type
dir *x.dat
you will get a list of all files with .dat extension- in other words, anything after the * in the name or extensionis ignored.
Note 2: DOS provides no way to list all files whose nameends with x regardless of how many characters are in thename - for example, there is no simple way to find all these files:
x.dat
ax.dat
abx.dat
abcx.dat
etc.
Return to Contents of this document
Changing Default Drive and Directory
- Make C: the default:
- c:
- Make the root default
- cd \
- Change to the Winword directory
- cd \msoffice\winword
- Change to the parent directory (one up)
- cd ..
Return to Contents of this document
Handling Files: Copying, Deleting, and Renaming
- Copy from default to A:\
- copy file.ext a:\
- Copy from A:\ to default
- copy a:\file.ext
- Copy all files in a directory to default
- copy c:\msoffice\windows\template\*.*
- Delete one file
- del a:\file.ext
- Delete all files in a directory
- del c:\temp\*.*
- Delete all files in the current drive and directory whosename begins with the letter q
- del q*.*
- Rename a file.abc to be file.xyz
- rename file.abc file.xyz
- Rename all files ending .abc
- rename *.abc *.xyz
Return to Contents of this document
Background Concepts
DOS Disk Concepts
Computers using MS-DOS have access to files stored on one or moredisk. Here are some facts about how DOS handles its disks:
- Each disk drive is assigned a letter, beginning with A, foridentification.
- A colon : after the drive-letter identifies it as adrive name, as opposed to a file name.
- The letter is associated with the drive, not with a particulardisk. You can change the disk in a diskette drive, and the drivestill has the same letter.
- Certain drive-letters are customarily associated with particulartypes of drives:
- A: is for a diskette (floppy) drive. If there is more thanone diskette drive on a computer, the A: drive is usually theupper one, or the one on the left. When you start DOS computers,most of them will try to use a disk in A: as the boot-disk - thatis, they will look for startup instructions first on A:
- B: is for a second diskette drive, if any. Computers thathave only one diskette drive will not have a B: drive.
- C: is for the primary hard disk drive. Even if there is onlyone diskette drive, hard disk drives are not called B:. If thereis no diskette in the A: drive when you turn them on, most DOScomputers will try to use hard disk C: as the boot-disk.
- D: and E: are generally some form of high-capacity storageon the local computer. They may be:
- a second hard drive
- a CD-ROM drive
- a "partition" of another hard drive. (A partitionis a large section of a hard disk that has been formatted separatelyand is treated as a different disk.)
- On many networked computers, the letters F-Z are used to represent"logical disks" on a network server. (A logical diskis one which may be either a real disk, a subdirectory that "behaves"like a disk, or a partition.)
Return to Contents of this document
Directories
A directory is a part of a disk whose files can be handledas a separate group. What the Macintosh calls "folders"are the "directories" of DOS. This concept is usefulbecause disks can hold such large numbers of files that, withoutsome way of organizing them into groups, it would be nearly impossibleto deal with them rationally.
Return to Contents of this document
Directory background
- Every disk has at least one directory: the root directory.
- The root directory can contain a large number of other directories,as well as files.
- A directory contained in another directory is called a subdirectory.
- Subdirectories can contain a large number of other directories,as well as files.
- Because of this, directories form a structure like the branchesof a tree. This is sometimes called a "hierarchical"structure.

Return to Contents of this document
DOS Directory Rules
- On DOS computers, the root is symbolized by a backslash immediatelyafter the drive letter:
A:\ or C:\ would be the root directories of A: andC:. - DOS subdirectories must have names that follow the same rulesas DOS files (see below)
- When they are used in commands, directory names are separatedfrom one another and from file names by the backslash \character. Ex:
C:\web\site\q02cd.htm
In this example, C:\ is the root, web is onesubdirectory, site is another, and q02cd.htm isprobably the name of a file - but it could be a directory instead.DOS leaves this ambiguous. - The complete listing of drive and all the directories neededto reach a file is called a "path". A long "path"is:
c:\msoffice\winword\template\normal.dot - Special directory names:
. is the symbol for the current directory
.. is the symbol for the "parent" directory.The parent of site is web, because site islisted (contained) in web.
\ is the symbol for the "root" directory.
Return to Contents of this document
Default Drive and Directory
Since we have to type all DOS commands, any way of shorteningcommands is helpful. One such technique is by defining a defaultdrive and directory - a disk drive and (sub)directory whichDOS assumes you want to use. That way, you don't have to typeit out every time you refer to its files. You can think of DOSas always "looking at" the default disk and directory.
- The default drive and directory are usually shown in the DOSprompt - the string of characters that indicates DOS is readyto accept a command. For example:
C:\WEB\SITE>_ - The default drive can be changed by typing the letter of thedisk you're aiming for, followed by a colon. Ex:
A: <Enter>
should get you the prompt
A:\>_ - The default directory is changed by giving the cd command.You can cd to any directory in the current directory, or if youlist the entire path, you can cd to any directory on the defaultdisk drive. However, you need to change the default drive firstif the directory you want is on another drive.
Return to Contents of this document
DOS File Name Rules
DOS file names are restricted by several rules - mainly constrainingtheir length and the characters they can have in them. Here arethe basics:
Parts
- Overall:
- DOS file names consist of a name and an extension.
- Name:
- Every file must have a name, 1-8 characters long. Names areuseful for explaining what the contents are about. Examples:
a
taxes
budget94
96income
slurp - Extension:
- Extensions are optional, but very useful. They may be 1-3characters long. They usually give information about the typeof file - for example, whether it is a program, a text file, agraphic image, or a word processing document. There are severalstandard extensions, and hundreds of extensions used by specificprograms. Many programs automatically add extenstions to yourfile names, and you should let them do this. Examples:
autoexec.bat - a batch file contains a group of DOS commands(standard)
word.exe - an executable (runnable) program file (standard)
q02c.doc - a document file, usually either Word Perfector Microsoft Word format (used by several word processing programs)
q02c.htm - an HTML (HyperText Markup Language) file, foruse on the World Wide Web
q02c_f1.gif - an image file using the GIF (Graphic InterchangeFormat) technique for storing images. - Separator:
- File names and extensions must always be typed with a period. between, though when DOS lists a directory, space is used toseparate them.
Characters
- DOS is not sensitive to case. You can type ABC.DOCor abc.doc or Abc.Doc or any other combination ofupper and lower case letters, and DOS won't care.
- You can combine letters and numbers in any order. These areall OK:
123abc.xyz
def567.9yz
34.8 - Some special characters are OK to use, but others are not.Generally, the characters that have a special meaning in DOS commandsare not OK in names.
OK ~ ` ' ! @ # $ % ^ & ( ) _ - { }
Not allowed * + = | \ [ ] : ; " < , > ? / .but period is OK for separating name and extension.
Return to Contents of this document
Audience:
This is for people who have at least learned how to turn on acomputer, and need to know how to do just enough with the Microsoft® Disk Operating System (MS-DOS) to do basic work.(This is relevant to all versions of MS-DOS through 6.22).
Objectives:
By consulting this reference guide, you will be able to...
- Understand the concept of hierarchical directories
- Understand the concept of the "default drive and directory"
- Identify and change the current drive and directory
- Give legal DOS names to files
- Identify the information given in a DOS directory listing
- Identify the wildcard characters used in DOS file commands
- Do directory listings with the following characteristics:
- Normal
- Wide
- Sorted by name
- Using wildcard characters
- Copy files from one disk or directory to another
- Delete files
- Rename files
Return to Contents of this document
About this document...
Module Q02c: MS-DOS Summary: A Survival Guide
- Author:
- LaurenceJ. Krieg
- Institution:
- Departmentof Computer Information Systems,Washtenaw Community College
- History:
- Original version: 12 January 1996
Amplified HTML version 18 February 1996 - Copyright:
- Copyright © 1996, Laurence J. Krieg.
Instructors: You may point to this file in your Web-based materials.
Students: you may make a copy for your personal use.
All other uses: contact the author, Laurence J. Kriegfor permission.
Return to Contents of this document