Skip to document

Learning MS-DOS Basics - A Tutorial

Course

Mathematics (Math101)

47 Documents
Students shared 47 documents in this course
Academic year: 2021/2022

Comments

Please sign in or register to post comments.

Preview text

Learning MS -DOS Basi cs - A Tutorial

This tutorial gives you an opportunity to try basic MS-DOS commands. By following the procedu res in this section, you will learn to:

o View the contents of a directory o Change from one directory to another o Create and delete directories o Change from one drive to another o Copy files o Rename files o Delete files o Format a floppy disk

The Command Prompt

When you first turn on your computer, you will see some cryptic information flash by. MS-DOS displays this information to let you know how it is configuring your computer. You can ignore it for now. When the information stops scrolling past, you'll see the following:

C:>

This is called the command prompt or DOS prompt. The flashing underscore next to the command prompt is called the cursor. The cursor shows where the command you type will appear.

Typing a Comm and

This section explains how to type a command at the command prompt and demonstrates the "Bad command or file name" message.

  • To type a command at the command prompt

1. Type the following at the command prompt (you can type the command in either uppercase or lowercase letters ):

nul

If you make a typing mistake, press the BACKSPACE key to erase the mistake, and then try again.

  1. Press ENTER.

You must press ENTER after every command you type.

The following message appears:

Bad command or file name

The "Bad command or file name" message appears when you type something that MS- DOS does not recognize. Because nul is not a valid MS-DOS command, MS-DOS displays the "Bad command or file name" message.

  1. Now, type the following command at the command prompt:

ver

The following message appears on your screen:

MS-DOS version 6.

Viewing the Contents of a Directory

In this section, you will view the contents of a directory by using the dir command. The dir command stands for " directory ."

  • To view the contents of a directory
  1. Type the following at the command prompt:

dir

A list similar to the following appears:

*Volume in drive C is MS-DOS_6. Volume Serial Number is lE49-15E Directory of C:*

WINDOWS <DIR> 09-08-92 10:27p TEMP <DIR> 05-15-92 12:09p CONFIG SYS 278 09-23-92 10:50a COMMAND COM 53014 09-18-92 6:00a WINA20 386 9349 11-11-91 5:00a DOS <DIR> 09-02-92 4:23p AUTOEXEC BAT 290 09-23-92 10:54a

7 file(s) 62931 bytes 8732672 bytes free

This is called a directory list. A directory list is a list of all the files and subdirectories that a directory contains. In this case, you see all the files and directories in the main or root directory of your drive. All the files and directories on your drive are stored in the root directory.

Changing Directories

Look at the list on your screen. All the names that have <DIR> beside them are directories. You can see a list of the files in another directory by changing to that directory, and then using the dir command again. In this case, you will change to the DOS directory.

  1. To view the next screen of information, press any key on your keyboard. Repeat this step until the command prompt appears at the bottom of your screen.

When you typed the dir command this time, you included the /p switch after the command. A switch modifies the way MS-DOS carries out a command. Generally, a switch consists of a forward slash ( / ) that is followed by one or more letters or numbers. When you used the /p switch with the dir command, you specified that MS-DOS should pause after it displays each screen of directory list information. The p actually stands for "page"

Another helpful switch you can use with the dir command is the /w switch. The /w switch indicates that MS-DOS should show a wide version of the directory list.

o To view the contents of a directory in wide format

1. Type the following at the command prompt:

dir /w

The directory list appears, with the filenames listed in wide format. Note that only filenames are listed. No information about the files' size or date and time of creation appears.

  1. If the directory contains more files than will fit on one screen, you can combine the /p and /w switches as follows:

dir /w /p

Changing Back to the Root Directory

Next, you will change from the DOS directory to the root directory. The root directory is the directory you were in before you chang ed to the DOS directory. Before you begin this section, make sure your command prompt looks like the following:

C:\DOS>

o To change to the root directory

  1. Type the following at the command prompt:

*cd *

Note that the slash you type in this command is a backslash ( ** ), not a forward slash ( / ).

No matter which directory you are in, this command always returns you to the root directory of a drive. The root directory does not have a name. It is simply referred to by a backslash ( ** ).

The command prompt should now look like the following:

C:&gt;

When your command prompt appears similar to this---that is, when it does not contain the name of a directory---you are in the root directory.

Creating a Directory

In this section, you will create two directories. Creating a directory is helpful if you want to organize related files into groups to make them easy to find. Before you begin this section, make sure the command prompt looks like the following:

C:&gt;

To create a directory, you will use the md command. The md command stands for "make directory."

o To create and change to a directory named FRUIT

  1. Type the following at the command prompt:

md fruit

You have now creat ed a directory named FRUIT. You won't see the new FRUIT directory until you carry out the dir command in the next step.

  1. To confirm that you successfully created the FRUIT directory, type the following at the command prompt:

dir

or

dir /p

Look through the directory list. A new entry somewhere in the list should look similar to the following:

FRUIT <DIR> 09-25-93 12:09p

  1. To change to the new FRUIT directory, type the following at the command prompt:

cd fruit

The command prompt should now look like the following:

C:\FRUIT>

You will now create a directory within the FRUIT directory, named GRAPES.

o To create and work with a directory named GRAPES

When the cd command is followed by two periods ( .. ), MS-DOS moves up one level in the directory structure. In this case, you moved up one level from the GRAPES directory to the FRUIT directory.

Del eting a Directory

If you no longer use a particular directory, you may want to delete it to simplify your directory structure. Deleting a directory is also useful if you type the wrong name when you are creating a directory and you want to delete the incorrect directory befo re creating a new one.

In this section, you will delete the GRAPES directory. Before you begin this section, make sure the command prompt looks like the following:

C:\FRUIT>

To delete a directory, use the rd command. The rd command stands for " remove directory ."

o To delete the GRAPES directory

1. Type the following at the command prompt:

rd grapes

  1. To confirm that you successfully deleted the GRAPES directory, type the following at the command prompt:

dir

The GRAPES directory should no longer appear in the directory list.

Note You cannot delete a directory if you are in it. Before you can delete a directory, you must make the directory that is one level higher the current directory. To do this, type cd.. at the command prompt.

Changing Drives

This section describes how to change drives. Changing drives is useful if you want to work with files that are on a different drive.

So far, you have been working with drive C. You have other drives you can use to store information. For example, drive A is your first floppy disk drive. The files and directories on drive A are located on the floppy disk in the drive. (You might also have a drive B, which contains the files and directories stored on the floppy disk in that drive.)

Before you begin this section, make sure your command prompt looks like the following:

C:\FRUIT>

o To change to and view files on a different drive

  1. Insert a 3" floppy disk in drive A label- side up. Make sure the disk clicks into the drive.

1. Type the following at the command prompt:

a:

Note that the command prompt changed to the following:

A:&gt;

This message may appear:

Not ready reading drive A

Abort, Retry, Fail?

If you see this message, the disk may not be inserted properly. Place the disk label-side up in the disk drive, and make sure the disk clicks into the disk drive. Then, type r for Retry. If this message appears ag ain, press F for Fail, and then type b: at the command prompt. If you no longer see this message, type b: instead of a: throughout the rest of the tutorial.

There must be a floppy disk in the drive that you want to change to.

  1. Change back to drive C by typing the following at the command prompt:

c:

Your command prompt should return to the following:

C:\FRUIT>

When you type a drive letter followed by a colon, you change to that drive. The drive letter that appears in the command prompt shows which drive is the current drive. Unless you specify otherwise, any commands you type are carried out on the current drive and in the current directory.

So far, all the commands you typed were carried out on the current drive and in the current directory. You can also carry out a command on a drive that isn't current. For example, you can view the files on a disk in drive A without switching to drive A by following this procedure.

o To view the contents of the WINDOWS directory on drive C

  1. Type the following at the command prompt:

dir notepad

A list similar to the following appears:

3. To copy the NOTEPAD file from the WINDOWS directory to the FRUIT directory, type the

following at the command prompt:

copy c:\windows\notepad c:\fruit

The following message appears:

1 file(s) copied

  1. To confirm that you copied the files successfully, view the contents of the FRUIT directory by typing the following at the command prompt:

dir \fruit

You should see the file listed in the FRUIT directory.

Renaming Files

This section explains how to rename files. You may want to rename a file if the information in it changes or if you decide you prefer another name.

To rename a file, you will use the ren command. The ren command stands for " rename ." When you use the ren command, you must include two parameters.

The first is the file you want to rename, and the second is the new name for the file. You separate the two names with a space. The ren command follows this pattern:

ren oldname newname

  • Renaming a File

In this section, you will rename the README file.

Before you begin this section, make sure your command prompt looks like the following:

C:\FRUIT>

1. To rename the NOTEPAD file to PADNOTE, type the following at the command

prompt:

ren notpad padnote

  1. To confirm that you renamed the file successfully, type the following at the command prompt:

dir

Del eting Files

This section explains how to delete, or remove, a file that you no longer want on your disk. If you don’t have very much disk space, deleting files you no longer use is essential.

To delete a file, you will use the del command. The del command stands for "delete."

  • Deleting a File

In this section, you will delete two files using the del command.

Before you begin, make sure your command prompt looks like the following:

C:\FRUIT>

To delete the PEARCOM and PEAR files

1. Delete the PADNOTE file by typing the following at the command prompt:

del PADNOTE

  1. To confirm that you deleted the files successfully, type the following at the command prompt:

dir

  • Deleting a Group of Files

In this section, you will use wildcards to delete a group of files.

Before you begin this section, make sure your command prompt looks like the following:

C:\FRUIT>

To delete files in the current directory that end with the extension OLD by using wildcards

1. View all files that end with the extension OLD by typing the following at the command prompt:

dir *.old

A list of all the files that end with the extension OLD appears. Make sure that these are the files you want to delete. When you are deleting files by using wildcards, this step is very important. It will prevent you from deleting files accidentally.

  1. Delete all files ending with OLD by typing the following at the command prompt:

del *.old

  1. To confirm that all the files with the extension OLD have been deleted, type the following at the command prompt:
Was this document helpful?

Learning MS-DOS Basics - A Tutorial

Course: Mathematics (Math101)

47 Documents
Students shared 47 documents in this course
Was this document helpful?
Learning MS-DOS Basics - A Tutorial
This tutorial gives you an opportunity to try basic MS-DOS commands. By following the
procedu res in this section, you will learn to:
o View the contents of a directory
o Change from one directory to another
o Create and delete directories
o Change from one drive to another
o Copy files
o Rename files
o Delete files
o Format a floppy disk
The Command Prompt
When you first turn on your computer, you will see some cryptic information flash by.
MS-DOS displays this information to let you know how it is configuring your computer.
You can ignore it for now. When the information stops scrolling past, you'll see the
following:
C:\>
This is called the command prompt or DOS prompt. The flashing underscore next to
the command prompt is called the cursor. The cursor shows where the command you
type will appear.
Typing a Command
This section explains how to type a command at the command prompt and demonstrates
the "Bad command or file name" message.
¥ To type a command at the command prompt
1. Type the following at the command prompt (you can type the command in either
uppercase or lowercase letters ):
nul
If you make a typing mistake, press the BACKSPACE key to erase the mistake, and
then try again.
2. Press ENTER.
You must press ENTER after every command you type.
The following message appears:
Bad command or file name