MS DOS Handout for A+ Software

 Courses  A+ OS Design Samples

MS DOS Commands

MS DOS History

Partitioning and FDISK

Formatting Explained

Boot files DOS needs: IO.SYS, MSDOS.SYS, Command.com

Config.sys and Autoexec.bat 

DOS characteristics and terms

Types of commands: Internal and external

Formatting, Delpart and FDISK step-by-step

MS DOS COMMANDS
MS-DOS is an operating system using a command-line interface. Commands are case insensitive, but must be entered in the correct syntax. After you type command, press the enter key to execute. 

Action required  Type the following DOS Command

Display DOS Version

VER

Display (or change) Date

DATE

Display (or change) Time

TIME

Change prompt to show directories

PROMPT $P$G

Display the help index:

HELP

Display help for a specific command:

HELP <command> or <command>/?

Repeat last command (one character at a time)

right arrow

Other command line editing keys

Insert, Delete, Backspace, left arrow, Home, End

Repeat entire last command

F3

Change default drive to A:

A:

Change default drive to C:

C:

Format a disk:

FORMAT <drive:>

Format a system disk

FORMAT <drive:>/S
Unformat a disk UNFORMAT <drive:>
Label a formatted disk LABEL <drive:>

Display volume label

VOL <drive>:

List files

DIR <drive:>

List files in a directory

DIR <drive:\directory>

List files in 5 columns

DIR <drive:>/W

List files with pause

DIR <drive:>/P

List files with a specific name:

DIR <drive:>\<filename>.*

List files with a specific file extension

DIR <drive:>\*.<ext>

Restart (boot) the computer

Ctrl + Alt + Del

Wildcard for character

?

Wildcard for all

*

Sort directory by filename

DIR/ON

Sort directory by extension

DIR/OE

Sort directory by file size

DIR/OS

Sort directory by date

DIR/OD

Copy a file

COPY <from drive:>\<filemane> <to drive:>

Copy all files

COPY <from drive:>\<*.*> <to drive:>

Copy all files including subdirectories

XCOPY <from drive:>\<*.*>/S <to drive:>

Duplicate a disk

DISKCOPY <from disk:> <to disk:>
Rename a file REN <old name> <new name>

Delete a file

DEL <filename>

Delete all files with a specific filename

DEL <filename>.*

Delete all files with a specific extension

DEL *.<ext>

Delete all files

DEL <*.*>

Undelete a file

UNDELETE <filename>

 List undeleted files

UNDELETE <drive:>/LIST

Create a directory from current directory

MD <directory name>

Remove a directory from current directory

RD <directory name>

Change default directory

CD <directory name>

 Return to the root directory

CD\

 Move up one directory

CD ..

List directories

DIR <*.>

 List directories

TREE <drive:>

 List directories and files

TREE <drive:>/F

 Check status of memory and disk space

CHKDSK

 Check status of disk space and fix lost clusters

CHKDSK/F

Check status of RAM

MEM

Check upper/lower RAM status

MEM/C|MORE

 Display ASCII text file

TYPE <filename>

 Display ASCII text file with pause

TYPE <filename>|MORE

Create a batch file

COPY CON <filename.bat>

End creation of a batch file

Ctrl + Z or F6

Edit  or create a batch file

EDIT <filename.bat>

Print contents of the screen

Shift + PrtScr

Turn on printing all screen contents

Ctrl + PrtScr

Turn off printing all screen contents

Ctrl + PrtScr

Make a path

PATH=<dir>;<dir>;<dir>

Diagnostics

MSD

History:
Before the introduction of DOS, most microcomputers used another operating system called CP/M (Control Program/Microcomputers). Unix, the precursor to DOS, was running on large mainframes with several workstations connected to the mainframe server. When IBM decided to introduce its own microcomputer into the market place in 1981, one of its subcontractors, a very small company at the time, called Microsoft, offered to provide the operating system software for the IBM PC. Microsoft suggested running an OS off of a disk, which allowed for stand-alone personal computers. Thus Disk Operating System = DOS. Microsoft then completed the work on an operating system named 86-DOS, which was similar to CP/M. DOS 1.0 was the result. DOS became the predominant operating system used on microcomputers. Between 1981 and 1993 twelve versions of DOS were released, the earliest DOS 1.0, the latest DOS 6.2

The operating system can be divided into three distinct sections:

bullet(1) boot files – which takes over control of the system from the ROM BIOS during startup,
bullet(2) file management files – which allow the user to manage information within itself, and
bullet(3) utility files – which allow the user to configure the system for maximum performance.

Contrary to Windows, DOS uses a command line interface, (no GUI graphical user interface) which depends upon the operator to understand the commands and enter them correctly. You have to be familiar with the commands in order to work with DOS.

Partition and FDISK:
In order for a hard drive to be usable, it must be organized in a way that your computer can understand. Therefore we can partition our hard drive: Partitions are logical divisions of a hard drive; they cannot be seen if a hard drive is opened. Partitions exist for two reasons: First, DOS was initially designed to use hard drives, the largest hard drive that could be used was 32 MB because of the way DOS stored files on the hard drive. Partitioning was included in DOS 3.3. and higher to allow larger physical hard drives by creating multiple logical drives, up to 32 MB each. The second function of partitions is the ability to use more than one operating system. One OS could be added to one partition and another OS could be added to another, allowing a computer to have more than one OS.
Within DOS/Windows, a hard drive can be divided into two types of partitions, primary and extended. The primary partition is where the operating system is stored. If you want to boot from a hard drive it must have a primary partition. Primary partitions are for storing the boot sector, which tells the computer where to find the operating system. The name of the primary partition is C:
The other type of partition is known as an extended partition, which is for a hard drive or part of a hard drive that does not have an operating system. The extended partition is not associated with a drive letter. By creating an extended partition we are actually putting a fence around our disk space. After putting the fence around the space we can create additional partitions and divide the extended partition (=the "fence) further into "logical drives", starting with D.

Explanation of Partitioning and Terms:
The following is an explanation of the steps involved: Assume that you have an 8-GB hard drive installed; you partition a drive using the utility FDISK that comes with DOS and Windows 95. Running FDISK will start the operating menu. First you need to create your primary partition, an extended partition, and then you can create logical drive within the extended partition. In the process do not confuse primary and active partitions.

  1. The primary partition is where the operating system is stored on the hard drive. Other operating systems can exist on the extended partition. So the primary partition is where the DOS boot files reside
  2. he active partition is where BIOS searches for the operating system to be booted. The active partition is an issue only when more than one operating system is to be installed on one hard drive; otherwise always set the primary partition to be active.

Formatting Explained:
Formatting performs two major functions, creating and configuring the file allocation tables (FAT) and creating the root directory. The DOS root directory is the foundation structure upon with files and sub-directories are built. The primary partition, as well as every logical drive in the extended partition, must be formatted separately. To format a drive, the first step is to verify that the drive is already partitioned. From the A:\ prompt, run the FDISK command as follows: FDISK/STATUS. This will quickly allow you to see the partitions on the drive. We will briefly discuss the process of formatting and the "file cabinet of the drive", the FAT.

The base storage for hard drives is a sector, and each sector can store up to 512 bytes of data. If file less than 512 bytes is stored in a sector, the rest of the sector is wasted. This waste is acceptable, since most files are far larger than 512 bytes. So what happens if a file larger than 512 bytes is stored? There is a way to fill one sector, find another sector that is unused and fill it –continuing to fill sectors until the file is completely stored. Also, it is important to remember which sectors a file is store in should that file need to be retrieved.

In the DOS that first supported hard drives, MS-DOS version 2.1, a special data structure was created to keep track of where the data was stored on the hard drive. This structure is called the File Allocation Table or FAT. The FAT is nothing more than a "card catalog" that keeps track of which parts are stored near the beginning of the partition. These FAT's, #1 and #2, are carbon copies of each other. The DOS FAT is a 16-bit FAT (Floppy drives also use FAT but are only 12 bits, called FAT 12). The FAT contains information on the status of sectors and determines if a bad sector should be made unusable, and so prevent writing and storing data to this sector.

DOS Boot files and characteristics

If you have created a file in Windows which uses over 8 chars in its name and then view it in the MS DOS prompt to see the name truncated with a tilde (~)
DOS does not allow multitasking:, so only one application open at a given time
DOS is text based, although applications can be graphical
DOS does not support mice, although is supports applications that use them
DOS is case insensitive although it is common to use uppercase
DOS is composed of three main files, accompanied by roughly 80 support files. . With these three files, any PC can boot up. These files must be on the C: drive or the computer will not boot
  1. IO.SYS —Handles talking to the BIOS and hardware
  2. MSDOS.SYS —Is the primary DOS code, of called the "kernel" (a kernel is the fundamental part of a program, typically and O/S, that resides in memory at all times and provides the basic services. This part of the O/S may activate the hardware directly or interface to another software layer that drives the hardware)
  3. COMMAND.COM —Actually interprets commands typed into the computer and passes the info to MSDOS.SYS. Also called the command interpreter

In Win 98 you use Device Manager to determine your system resources and edit the devices in your PC. A program that controls a device is called a device driver. A device driver is basically a software program that handles the interface between the device and the O/S or application programs. Whenever a program wants to access that device, it must talk to the device driver which then passes the message on to the device itself. Every device, whether it is a printer, disk drive, keyboard, must have a driver program to communicate between the O/S, program/software, and the device itself. For a driver, to be the interface between the hardware and O/S, it must be loaded before the O/S starts. In DOS this means loading from the:

CONFIG.SYS file: It sets up the hardware configuration. It is a text file in the root directory of C: and is used to load extra BIOS for hardware that your system BIOS does not support.
AUTOEXEC.BAT: (Automatically Execute Batch File) sets up the software configuration. You use AUTOEXEC.BAT to customize routine operations by creating an special batch file that DOS automatically executes when you power on your system.

Two types of commands in DOS:

Internal commands = a command for which the program instructions are stored in the computer’s memory as part of DOS. The program code for internal commands is stored in the command interpreter, COMMAND.COM. DOS can quickly locate and execute program instructions for internal commands because they are store in RAM and are easily accessed. If you delete COMMAND.COM, you can no longer command DOS to do anything at the command line..
Examples are : Dir, Copy, Del, Ren, Type and Cls
External command = A separate utility program that comes with DOS or a command for which the program instructions are stored in a file on a hard disk or diskette. DOS must first locate the file with the program instructions. Then it must copy those program instructions into RAM so that you can use the program. It takes longer for DOS to locate an external command than an internal command because accessing disks is slower than accessing RAM (memory). External commands allow you to use the system utilities included with DOS.
Examples are: Format, DISKCOPY, XCOPY, Tree, Backup and Restore

DELPART, FDISK, FORMATTING  AND DOS INSTALLATION STEP-BY-STEP

Reboot your system (Ctrl + ALT+DEL)
Go into CMOS:
Press delete key
Type in password (if needed)
Go to BIOS features setup and press Enter
Go to Boot Sequence
(Using PgUP, Pgdn Key) Select option A, C, SCSI
Press Escape key
Insert the DOS bootable disk in A:\ drive
Hit F10 key and select Y for save and press Enter
DOS bootable disk
You are at the A:\
Type: DIR/W
Note the three programs: DELPART.EXE ; FDISK.EXE; FORMAT.COM
Type: DELPART to open the Delpart program
At warning screen: Press Enter
NB: (Tab key toggles between choice OK and Exit).  step 1. Select Partition press Delete key step 2. Press Y for Yes and Enter
Repeat steps 1+2 for every partition until the screen says "No partitions defined"
Exit by ALT + F X (or F3 key) and Y to save
Remove floppy from A:\ prompt and press Enter to restart
Error message: DISK BOOT FAILURE, INSERT SYSTEM DISK AND PRESS ENTER
(You are missing the system files!)
Reinsert floppy in A:\ and reboot (=pressing CTRL + ALT + DEL)
FDISK: The Process
At A:\ type Fdisk and press Enter to launch Fdisk program
At Fdisk options menu:
1. Create primary partition (=where DOS boot files resides)
2. Set Primary to Active (
Where BIOS searches for OS to be booted)
3. Create extended partition of 2 GB (=creating fence)
4. Create 2 logical drives within the extended partition
FDISK: The steps to take
1. Enter Choice 1 (create DOS Partition or Logical DOS Drive)
2. Enter Choice 1 (Create Primary DOS partition)
3. When asked maximum space available select "No": N + Enter
4. When asked to enter partition size: Enter 2047 (=approx. 2 GB)
5. Upon "Primary DOS partition created" press Escape key
6. Enter Choice 2 (set Active Partition) and press Enter
7. Upon "Enter the number of the partition you want to make active…" type 1
8. Upon "Partition 1 made active" press Escape
9. Enter Choice 1
10. Enter Choice 2 (Create extended DOS partition)
11. Upon question "Enter partition size…" press Enter.
NB: Use max space available when fencing!
12. Press Escape key
13. Upon asked to enter Logical drive: divide remaining space in half: (i.e. 1000) and press Enter
14. Press Enter (Now you have D + E drive)
15. Hit Escape key
16. Choose option 4 Display partition information
17. Hit Escape key "System will now restart" and press any key.
18. Leave floppy in A:\ because we are booting from A:\ drive
FORMATTING
1. At A:\ type format C:
2. Say Yes to proceed with format and observe formatting process (this may take 10 minutes or more)
3. When asked for volume label press Enter for none
4. Repeat steps 1-3 for drive D and E: (N.B: type format D: format E)
Loading a DOS Operating System
Take bootable floppy out of you’re A:\ drive
Insert DOS disk 1 and reboot
At first screen "Welcome to Setup" Press Enter
At date and time screen press Enter
At C:\DOS prompt Press Enter
Setup begins
When prompted insert disk 2: Remove floppy 1 and insert floppy disk 2
When prompted insert disk 3: Remove floppy 2 and insert floppy disk 3
When prompted "Remove disks from all floppy disk drives" remove
floppy 3 and press Enter
MS-DOS is now installed. Press Enter to reboot your system

Back to Top