Lab 1-9 Using DOS!

 

Now that you have DOS installed in your VM you’re going to practice with it! Click on your DOS machine and click start. Do the stuff below!

 

Why DOS? Because commands are used in a variety of applications in Windows, even though there is a fancy schmancy GUI. There is an entire server OS (ironically still called Windows) that runs via command line. The command console in Windows Server 2003 and Longhorn is all command line. So learning DOS commands will help you in a variety of applications.

Creating a Directory Tree

In Windows you create folders by selecting newàfolder. Pretty easy! In DOS we don’t call them folders, we call them directories. To create a directory you use the command: MKDIR (stands for Make Directory…pretty clever, huh?)

 

Just like in Windows, you can embed directories…that is create a directory within a directory. A directory can contain other directories and files. A directory that contains directories is called a directory tree.

 

You can organize directories according to function, chronology, or subject. We’re going to create directories according to subject.

 

  1. Right now you have one directory on your computer. It is your root directory, C:\>. To see the contents of this directory type dir. What do you see in your directory?

 

 

 

 

  1. Does your data scroll off the screen? In order to see the contents of your directory in a “wide” version, type DIR /W. Note that capital and small letters are interchangeable. What does this command do?

 

 

 

Let’s Create a directory tree:

  1. Type mkdir Chicken. What happens?

 

 

  1. Type DIR. What happens?

 

 

  1. You want to go into that directory, so type cd chicken. CD stands for change directory. What do you see now?

 

  1. How can you tell you’re in the chicken?

 

  1. Create a directory named egg.

 

  1. Go into the egg.

 

  1. Create a directory named chick.

 

  1. Go into chick.

 

  1. To back out of a directory you type cd.. (cd period period). Type cd.. and where are you now?

 

  1. Back out until you are at your root directory (c:\). Now type the command tree. What do you see? (Draw it)

 

 

 

 

  1. Type the dir command. What is the difference between the tree command and the dir command?

 

  1.  Go back into egg (all the way in, but not all the way to chick) by using the cd command.

 

  1. You’re going to create a text file using the edit command. Type edit scramble. A blue (probably) screen will show up that looks like this:

  1. Type I love scrambled eggs.
  2. Since you don’t have a mouse (yet) in DOS, you’re going to have to use your keyboard. The alt key allows you to select a menu by holding down alt-and typing the highlighted letter in the menu (example alt-f opens the file menu as shown below)

  1. Type alt f x to exit. Say yes you want to save changes. This is one way to create a document. The edit command opens the text editor, by typing edit scrambled you either:
    1. Open up a new document that has the name scrambled, or
    2. Open up an existing document named scrambled.
  2. Type edit and hit enter. You now have a blank document. Type I like poached eggs too. Hit alt f x and this time it will ask you if you want to save and ask you to give it a name. Name it poached.
  3. Type dir and what do you see?

 

 

 

  1. Go back to the root directory. Type tree. Do you see the files you created? Why or why not?

 

 

Renaming a file

  1. To rename a file, type REN nameoffile newname.
  2. Go into your root directory and create a directory named fun.
  3. Go into fun and create a text file named games.
  4. Within fun type ren games toys
  5. What happens? Do a DIR.

 

Renaming (moving) a directory

  1. Type CD \ and press Enter (“\” in DOS represents the root directory).
  2. Create a directory named Student.
  3. To rename the Student directory to Student2, type MOVE C:\STUDENT C:\STUDENT2 and press Enter.
  4. To observe the results, type DIR and press Enter.

Moving files

  1. Go to your root directory and create a file named test.txt by typing edit test.txt. Type something in, exit, save.
  2. Back in C:\ type move c:\test.txt c:\student2\
  3. To observe the results, type DIR and press Enter. What do you see?

 

 

  1. Go back to your root. You can also move and rename a file at the same time! Create a new file named test2.txt in your root.
  2. Type move c:\test2.txt c:\student2\test3.txt. Do a DIR. What do you see?

 

Okay, I know you’re asking yourself, why are we using DOS? Why? DOS is deader than dead! Well there are a few reasons:

  1. You will be using a command driven interface when working with routers and switches in CISCO. Getting used to it by using DOS helps you to understand the importance of syntax, spelling, etc.
  2. In Windows Servers if you’re server dies and you can’t afford to simply reformat it, you can use the command prompt and the CD to resurrect it. It uses a minimal set of DOS commands.
  3. Many jobs you do within Windows 2003 server can be done from the command prompt or a wizard. Why use the command prompt when you have a wizard? It’s faster and you can’t create batch files that use a wizard. (Well, you can but not as easily.)
  4. You can create DOS driven scripts (batch files) that can be replicated across your network for doing simple jobs on the network.

 

Now back to your regularly scheduled programming.

Viewing and changing file attributes

  1. To change to the Student2 directory, type CD STUDENT2 and press Enter.
  2. To view the attributes of the test2.txt, type ATTRIB C:\STUDENT2\TEST2.TXT and press Enter.
  3. To make the file a hidden file, type ATTRIB +H C:\STUDENT2\TEST2.TXT  and press Enter.
  4. To observe the results, type DIR and press Enter.
  5. To remove the hidden attribute from the file, type ATTRIB -H C:\STUDENT2\TEST2.TXT and press Enter.

Putting it all Together!

You are going to take all the stuff you learned above and create a directory, look at the tree, create files and directories, rename them and move them on the test so let’s practice!

  1. Go to your root.
  2. Create a folder named Herd
  3. Go into Herd and create a subdirectory named cow.
  4. Create another subdirectory (in herd) named bull.
  5. Go into cow and create a text file named milk.
  6. Back out to your root directory.
  7. Do the tree command. Draw what you see.

 

  1. NOW…you’re going to rename the bull directory to steer (poor bull, but he’s nicer now and much happier…trust me). Write the command you used to do this below:

 

 

 

  1. NOW…you’re going to move the milk file from the cow into the steer and rename it cud all at the same time. Wipe your brow…take a deep breath…get ready…you can do it! You can do it! GO! Write the command you used to do this below:

 

 

Review Questions

Circle True or False.

  1. The TREE command is not always available in recent versions of DOS. True /False
  2. When you receive the error message “Bad or missing command.com,” it means that the entire operating system is corrupt and must be reinstalled. True / False

 

  1. What does the CD command stand for?

 

 

  1. What is the ATTRIB command used for?

 

 

  1. Name one required DOS system file.

 

 

  1. Patrick, one of your customers, is trying to find a file located in the MyData directory on his computer. What command would you suggest that Patrick use to view the contents of the MyData directory?

 

 

  1. John has attempted to rename a directory using the following command: REN C:\MYDATA C:\MYSTUFF Explain why this command might not work, and recommend a different command for John to use.