Ana səhifə

Chapter 8 Microsoft Disk Operating Systems (ms-dos) Commands

Yüklə 50.5 Kb.
ölçüsü50.5 Kb.

Operating Systems – DPR355

Chapter 8

Microsoft Disk Operating Systems (MS-DOS) Commands

8.1 MS-DOS

  • The IBM personal computer (IBM PC) was released in 1981.

  • The general form of a command is shown below. The default drive and the system prompt are displayed by the operating system. The user responds by typing a command name followed by necessary parameters.

  • A delimiter, usually a space, separates the command from the parameters.

  • Some DOS commands are resident; in other words, they reside in memory whenever the operating system is loaded. Others are transient; they remain on disk and are read into memory only when needed. Resident commands can be issued even if the system disk is not in a drive; transient commands cannot.

C:\> COMMAND Parameters

One or more delimiters like


Comma (,)

Semicolon (;)

Equal sign (=)

Tab key.

Generally spaces are used.

8.2 Getting Started

  • When you switch on the computer, hardware automatically reads, from disk, a routine called the boot, which, in turn, loads the rest of the operating system. (If the computer is already run­ning, simultaneously pressing Ctrl, Alt, and Del has the same ef­fect.)

  • DOS stamps every file it creates or modifies with the date and time. Many programming languages include features that get the date and time from the operating system.

  • Many comput­ers contain a battery that supplies sufficient power to maintain the date, the time, and other key parameters even when the computer's primary power is cut.

  • To find DOS version type: VER

8.3 Formatting a Disk

  • The formatting process writes a pattern of sectors on the disk surface, records a copy of the boot routine on the first sector.


S stands for transfer of system files (COMMAND.COM, IO.SYS, MSDOS.SYS)

8.4 The File System

8.4.1 File Names

  • The DOS file system allows a user to identify, save, and retrieve files by name (A program is a type of file).

  • A file name is composed of the name itself and an optional extension. The name consists of from 1 to 8 characters. A few file names are reserved by the system, and delimiters (like blank space) may not be used; otherwise, just about any combination of characters you can type is legal.

  • The file name is separated from its 1-to 3-character exten­sion by a period.

  • Some extensions have special meaning to the operating system.

8.4.2 Directories / File allocation table (FAT)

  • The first time a file is written to disk, its name, disk address, cre­ation date, and other information are recorded In the directory (Fig. 8.1). Later, when the file is retrieved, the operating system reads the directory and searches it by name.

  • When a disk is first formatted, a single root directory is created.

Excel 01 00 05 19 Access 01 00 05 19 Word 01 00 05 19

File Starting

Name Address

The directory found on each disk is the key to accessing programs and files by name.

Fig 8.1


Letters Book Programs

FileA FileB FileC

Fig 8.2

8.4.3 Path Names

  • When subdirectories are used, you need more than a simple file name to find a file. For example, it is possible to have files named JOB recorded under two different directories. A reference to JOB would thus be ambiguous-which JOB do you mean? To identify a file, you need a complete path name; for example,


8.4.4 Viewing a directory

  • The check disk (CHKDSK) command checks a disk’s directory and reports on its contents.


F for fixing errors

  • The directory (DIR) command displays a directory’s contents.

Dir a:

  • The TREE command displays the directory path on the specified disk.

Tree A:/F

F for listing files in each directory

  • The make directory (MKDIR or MD) command creates a new directory.

MD a:\temp
8.4.5 Creating Files

  • One of the simplest ways to create a file is to copy the data from the console. For example, type:


  • The first file name, CON, stands for the console. To DOS, it means input data will be typed through the keyboard. After you enter the command, the cursor will appear directly under the command line (you'll see no prompt). At this point, you can type whatever you want. When you reach the end of a line, press re­turn. When you've typed all your lines, press function key F6 (the COPY command's sentinel value) and then press enter.

  • The COPY command copies one or more files from a source to a destination.

COPY a:\name c:\

8.4.6 Changing Directories

  • Directory LETTERS contains two unusual files: (.) and (..). The single dot refers to the directory itself; the double dot is a reference to its parent (in this case the root directory).

  • The root directory contains three subdirectories, none of which holds lower-level directories.

C;\Tree a:



8.4.7 Manipulating Files

  • The COPY command's first pa­rameter specifies a source file; the second parameter identifies the destination. If drive designators are prefixed to a parameter, a file on one disk can be copied to another. If a file name is speci­fied for the destination file, the new file name is used; if not, the source file name is assigned to the destination file. For example:


  • Copies a file named JOHN from drive A to drive B and assigns it path nameLETTERS\JOHN.

  • The command COPY B:\LETTERS \JOHN B:\LETTERS \MARY Reads file JOHN, makes another copy on drive B, and assigns it path name \LETTERS\MARY.

  • Special wild card characters allow a user to generalize the parameters. A question mark (?) represents any single charac­ter; for example, the file name identifies TERM.1, TERM.2, TERM.C, and any other file named TERM with a 1-character extension. An asterisk (*) represents multiple characters; for example, TERM. * stands for every file named TERM with a 1-, 2-, or 3-character extension, including TERM. 1, TERM. V6, and TERM.ABC.

  • Wild card characters are particularly useful for making backup copies of selected files or an entire disk. For example, A:\>COPY *.* B: copies every file on the disk in drive A to the disk in drive B, while:


  • Copies every file with extension TXT (generally, DOS text file) from drive A to drive B. to remove a file, use an DELETE (DEL) command.

  • To display a file's contents on the screen, you could code a COPY command with CON as its second parameter; for example,


  • An option is to code a TYPE command, such as


  • TYPE reads the specified file and displays it on the screen. You should see the same output.

  • Executable programs are assigned extensions COM or EXE. To load and execute a program, type its file name (with or without its extension) as though it were a command. If no extension is given, DOS will look for a resident command with the specified name. If it finds none, it will search for the file name with a .COM extension, then for a .EXE file extension, and finally for a .BAT file. (Batch files will be ex­plained shortly).

8.5 Pipes, Filters, and Redirection

  • Many DOS commands assume a standard input or output device; for example, the directory command sends its output to the screen. By using redirection parameters. A user can change those defaults.

  • To print the DOS directory, code DIR > PRN

  • To copy drive A’s directory to a file on drive C, code DIR > C: DFILE

  • If a program you have written expects its input from the standard input device (the Keyboard), and for testing purposes, you want to get input data from a text file, you can code something like:


  • A filter is a special type of command. It accepts input from the standard input device, modifies (or filters) the data in some way, and send the results to the standard output device. For example, SORT accepts data (fig below) accepts data from the keyboard, sorts the data values into alphabetical or numerical sequence, and outputs the sorted data to the screen.

  • With redirection, you can override or change the standard input device, output device, or both. For example, to sort the contents of a file and display the result on the screen, enter the command


  • To sort a file and store the output in a different file, code something like


  • The MORE command is another useful filter. It sends ouput to the terminal one screen at a time. MORE is generally used with pipes.

  • A pipe causes one command’s standard output to be used as the standard input to another command.

  • Pipes are designated by a vertical line (|).

  • The filter MORE reads text from the standard input devices and displays it one line at a time.


  • Type DIR | SORT | MORE to display data one screen at a time in alphabetical order.

8.6 Batch Files

  • While most DOS applications are interactive, you will occasionally encounter a need to issue the same set of commands over and over again. Typing those same commands every day is annoying. An option is to create a batch file.

8.7 Other Useful Commands

  • COMP compares two files and is used to verify a copy operation; DISKCOPY copies an entire disk, track by track; DISCOMP compares the contents of two disks. Another useful command, RECOVER, allows you to salvage at least portions of a file from a disk that contains bad sectors.

  • You have already considered two filters: MORE and SORT. Another filter, FIND, searches the standard input stream or, using redirection, a file for a specified series of characters.


Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur © 2016
rəhbərliyinə müraciət