An Overview of MS-DOS


MS-DOS as an Operating System

An operating system consists of one or more programs that control the allocation and usage of hardware and software resources and functions as an interface between the user, application programs, and the hardware.

Microsoft Corp. MS-DOS 1.0 came out in 1981. Since then there have been a number of upgraded versions, the last being Version 6 Release 22 (v6.22). Versions are upward compatible meaning that commands which worked in earlier versions will work in later versions. The command line MS-DOS has ben superseded by the more powerful GUI Windows operating system. However under Window you can run a “version” of MS-DOS in a Command Prompt window. This is useful for executing MS-DOS legacy software.  

Unlike GUI (Graphical User Interface) Operating Systems like Windows, MS-DOS has a command-line interface. That is commands are typed at the so-called MS-DOS prompt

     C:\Temp>
 

where C: identifies the default drive and\DOS identifies the default path. The top level directory, identified by a single \ as in C:\> is called the root directory.


Classifying MS-DOS Commands

MS-DOS commands fall roughly into three categories

 

Environment Commands: These report on or affect the operating system environment. Examples are CLS (clear screen), TIME, DATE, VER (display MS-DOS version number), and HELP.

 

File Manipulation Commands:  These manipulate files. Examples are COPY, DEL (delete), TYPE (display file to screen) and, DIR (directory - or list all files in current directory).

 

Utilities:  These perform some useful function. Examples are FORMAT (format a diskette) and EDIT (invoke MS-DOS text editor).


MS-DOS File Specifications

All files under MS-DOS are specified by a four part naming convention. MS-DOS File Manipulation commands identify files in this manner. Folder (directory) and file names are generally restricted to eight (8) characters which must be digits or letters. File extensions are restricted to three (3) letters.

drive:\path\filename.ext

 

drive:     is a single letter identifying the device where the file is found (e.g. C:)
 

\path\    is the hierarchy of directories (folders) where the file is found. Directories are separated by \ (back-slash character)
 

filename    is the file name of from 1 to 8 letters and or digits. Blanks and certain special characters are not allowed.
 

.ext   is the file type or extension of up to 3 non-blank characters. File types or extensions are used to identify the type of file where certain naming conventions are used. For example, .exe identifies an executable file, .txt indentifies an ASCII text file, .doc identifies MS-DOS Word document and .py identifies a Python source code file.

 

Remember all directory names and file names are limited to 8 characters (digits, or letters) although MS-DOS running under Windows allows longer names and allows the use of embedded blanks and/or other special characters.

               Example H:\Comp150Fa08\hello.py


Some MS-DOS File Manipulation Commands

Commands that reference files may either give the full file specification (drive:\path\filename.ext) or a partial file specification where the default drive and pathname values given by the MS-DOS prompt are used. The rule is when the drive name and/or path is not given, the default values are used.

For Example, full file specifications are given by

    C:\Temp> copy a:\file1.txt c:\dos\file1.txt
 

Alternately, one can use the default values where the target of the copy command defaults to c:\dos.

 

    C:\Temp> copy a:\file1.txt file1.txt
 

In the commands given below, we adopt the convention that anything enclosed in square brackets, [ ], is optional. For example, [x:\path\] refers to an optional device and/or path.

copy [x:\path\]source.ext [x:\path\]target.ext

    copies source file to target file.

 

del [x:\path\]filename.ext

    deletes file

 

move [x:\path\]source.ext [x:\path\]target.ext

    moves source to target

 

type [x:\path\]filename.ext

    displays the contents of file to screen. This only works for ASCII text files.

 

rename [x:\path\]source target.ext

    renames file. Note, target must be in same directory as source.

 

dir [x:\path\filename.ext]

    lists all files in directory.

 


Working with Directories and Path Names

The following commands can be used to create and remove subdirectories and set the default drive and directory. Again anything in square brackets [ ] is optional.

 C:\> H:
C:\Temp> chdir files
 

To make the root directory the default, use

 

C:\Temp> cd \
mkdir [\path\]directory 

 
md [\path\]directory
rmdir [\path\]directory



rd [\path\]directory
 

Important! The directory must be empty before you remove it
 

tree [drive:\path\]

 



Using the more command

One of the problems with MS-DOS commands is "screen overflow" - more material is displayed than can be held on screen. To get around this problem use the more command

To display the contents of a file one screen at a time use

    H:\> more filename.txt

To display execute an MS-DOS display command in conjunction with more use
h:\> cmd | more. For example

    H:\> dir | more

The vertical bar "|" character is called a "pipe"


Miscellaneous MS-DOS

C:\> dir h:\*.exe
 

will display all files in h:\ with an .exe extension
 

   

C:\> edit hello.txt
C:\> help
C:\Temp\Files> chdir ..

C:\Temp>

 


An On-Line Exercise Using MS-DOS