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:

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:

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

Return to Contents of this document


DOS Directory Rules

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.

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

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...

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