Fundamental Survival Skills in DOS
Module Q03hD6
Contents
Audience and Objectives
Overview
Getting Ready
- Explore the Help information center
- Create a directory on your diskette
- Copy all the files from another disk to the new directory
- Delete some of the files in the directory
- Rename some of the the files in the directory
- Create a second (sub)directory
- Move some of the files to the subdirectory
- List the files in various ways
About this document...
Overview
In this exercise, you will practice dealing with DOS files and directories.We will create several directories, copy, delete, and rename files, and deletea subdirectory. As you go, you will be using the DOS "help" feature to learnabout the important commands.
If you are viewing this with a Web Browser,you can click this symbol wherever it appears, if you need to to return tothe top of this Web page:
0. Getting Ready...
Begin by logging in to the local area network. This version is intendedfor use with the CIS100 account at Washtenaw Community College. If youare not sure how to do this, follow instructions given in a separate handout.
Do not run MS Windows.
1. Explore the Help information center
The DOS Help command gives very detailed information about all commands.Although it can sometimes be confusing, it is worth learning how to use Help.Remember the old proverb:
Give a man a fish and feed him for a day.
Teach a man to fish and feed him for life.
By learning how to use DOS Help, you'll be able to "fish" for your owninformation.
- At the DOS prompt (any DOS prompt!) type Help.
TIP: After you type any DOS command, press the <Enter> key. - Read the information at the top of the screen.
- Press the <F1> key to get more information about how to use Help.
- Use <Enter> key to get information about "Navigating through MS-DOS Help".
- Read the information, and...
- When you get to the bottom of the screen, use the <down-arrow> key to see more
- When you are done, press the <Esc> key to go back to the previous menu.
- Read any other parts of the Help information that might be helpful to you.
Pop question: How do you get out of Help when you're done?
Hint 1: It says how to do it on the Command Reference screen, at the top.
Hint 2: Try the File menu by pressing <Alt> F - From the Command Reference screen (the first one you saw when you ran Help) get information on the Md command.
- Exit Help.
2. Create a directory on your diskette
Make sure your diskette is in the computer. In most labs at WCC, thisworks best in drive B: I will assume that's where yours is. If not, youwill need to substitute A: wherever these instructions say B:
- Change the default drive to your diskette. Type:
b:
Tip: Since DOS is not case-sensitive, it doesn't matter if you use upper- or lower-case letters. You could have typed B: and gotten the same result.
Reminder (last time!): Press the
<Enter> key to have DOS carry out your command.
Check: Your prompt should now look like this:
B:\>
If not, try again. If this still doesn't work, ask for help.
- Create a directory on the root of your diskette. We'll just call it X. Type:
md x
Tip: Many DOS commands are made up of a command word (in this case, md) and one or two "parameters" (in this case, x) telling the command what to do. Always put a space after the command word, and spaces between the parameters if there are more than one. Spaces tell DOS where each part of the command begins and ends.
Check: You disk drive's light should come on for about 2 seconds, and shortly after that you should get the DOS prompt again. There is no other confirmation that your operation worked.
Tip: DOS works with the idea that "No News Is Good News". It will tell you if there was a problem, otherwise it won't say anything. - Check to see if the directory was created. Type
dir
You should see something like this (with a different disk name, and possibly with other files listed):
Volume in drive A is L KRIEG Volume Serial Number is 2D5F-0FE6 Directory of A:\X <DIR> 02-26-96 3:42p 1 file(s) 0 bytes 1,457,152 bytes free
3. Copy all the files from another disk to the new directory
- We want all our work for this exercise to be carried out under the X directory. To do this, we will make X the default directory by typing:
cd \x - Tip: You are about to type some pretty long, complicated commands. What if you make a mistake? The best way to take care of mistakes is to use DOSKEY, a feature that "remembers" the last several commands and lets you bring them back to re-use or edit, just be pressing the up-arrow key. But: you have to start DOSKEY before your type the complicated commands...just type:
doskey
and go ahead from there. - Several practice files are available on the network under the CIS100 directory. To get them, type:
copy H:\CIS\CIS100\KRIEG\DOS\dos\*.* - Tip: If you get an error message, and if you used DOSKEY as described in the Tip above, press the up-arrow. The previous command appears, and you can edit it using a few keys:
- Left and right arrow keys move the cursor
- Up and down arrow keys let you get to earlier and later commands
- Backspace deletes characters left of the cursor
- Delete deletes characters right of the cursor
- Insert lefts you add new characters into a line while pushing the rest to the right.
- Home and End keys get you to the beginning and end of the line.
- Check: a list of several files will appear on the screen as each is copied. The list should look like this:
H:\CIS\CIS100\KRIEG\DOS\100S3.WKSH:\CIS\CIS100\KRIEG\DOS\100S4.WKSH:\CIS\CIS100\KRIEG\DOS\BELLY.TXTH:\CIS\CIS100\KRIEG\DOS\HART.TXTH:\CIS\CIS100\KRIEG\DOS\FOX.TXTH:\CIS\CIS100\KRIEG\DOS\HORSE.TXTH:\CIS\CIS100\KRIEG\DOS\PEACOCK.TXTH:\CIS\CIS100\KRIEG\DOS\LION.TXTH:\CIS\CIS100\KRIEG\DOS\STATUE.TXTH:\CIS\CIS100\KRIEG\DOS\ANT.TXTH:\CIS\CIS100\KRIEG\DOS\100S5.WKSH:\CIS\CIS100\KRIEG\DOS\MYGRADES.WKSH:\CIS\CIS100\KRIEG\DOS\POLICY.DOCH:\CIS\CIS100\KRIEG\DOS\POLICY.WPS 14 file(s) copied
The order may be different, but there should be 14 files with the names listedhere.
4. Delete some of the files in the directory
We will delete the two files called "policy" by using wildcards.
- Type:
del policy.* - Check: Do a directory. (If you're not sure how, look at Step 2 above.)
You should see the same files as were copied before, but without policy.doc or policy.wps.
5. Rename some of the files in the directory
- Change ant.txt to grasshop.txt by typing:
rename ant.txt grasshop.txt
Check your success by using the dir command. - Tip: Want to see what's in a file? One way is to use the TYPE command:
type grasshop.txt
will display on the screen whatever is in the file grasshop.txt. Try it!
6. Create a second (sub)directory
- Make a second subdirectory under X. Let's call it Y. Type:
md y
Check by doing a directory.
7. Move some of the files to the subdirectory
We'll move all the text files to the Y subdirectory. To do this:
- Copy the files with the extentions .txt to the Y directory by typing:
copy *.txt y - There are now two copies of each file. We want only the copies in the Y directory. Delete the ones under the X directory by typing
del *.txt - Tip: Want to be sure you don't delete a file accidentally? If you plan to delete all the text (as we will do in a moment) but want to check them out first, type:
dir *.txt
and examine the list. If it's OK to delete all of them, just press the up-arrow (you did run DOSKEY, didn't you?) use the Home key to get to the beginning of the line, and change dir to del and press the Enter key.
8. List the files in various ways
The normal directory listing is in no particular order and may be too longto show on the screen. Use the DOS Help feature to figure out how to solvethese problems, or any other resources you have available.
When you have figures these things out, you will be ready to send a listingto the printer. Turn the listing in to your instructor. Note: Your diskshould be labelled with your first initial and last name. If not, type:
label f last
(substitute your first initial and last name, up to 9 characters, for f last)
Your directory should have these features:
- Wide listing
- Sorted in alphabetical order
- Lists the X and Y subdirectories with one command-line
This is a research question, to help you read and understand the Helpmessages and other resources. Here are some hints:
Hint 1: One DIR command can do all these things
Hint 2: You can tell the DIR command to add these features by using"switches," which are modifiers described in DOS Help.
Hint 3: As you read, write here any modifiers that might be usefulfor getting a directory feature:
| In order to get: | Use this modifier: |
| Wide listing: | / |
| File names in alphabetical order: | / |
| Include subdirectories: | / |
Write your complete directory command here: dir /__ /__ /__
Type the command at the computer, and see if it gives what was asked for.When it does, Send it to the printer by adding
> prn
as the last thing on the command line.
Audience:
This is for people who need to know how to perform the MS-DOS ® operationsneeded for fundamental use of a DOS-based computer. They need to know howto start the computer, insert a disk, and use the keyboard; formatting adisk is not covered in this unit. (These basics are discussed in modulesH1-H7.)
Objectives:
On successful completion of this unit, you will be able to...
- Use the DOS Help command to get information about commands
- Create and use hierarchical directories
- Identify and change the current drive and directory
- Give legal DOS names to files
- Use wildcard characters in DOS file commands
- Do directory listings with the following characteristics:
- Normal
- Wide
- Sorted by name
- Using wildcard characters
- Copy files from one disk or directory to another
- Delete files
- Rename files
About this document...
Module Q03hD6: Fundamental Survival Skills in DOS
- Author:
- LaurenceJ. Krieg
- Institution:
- Departmentof Computer Information Systems, Washtenaw Community College
- Date:
- Original 26 Feb 1996 (for WCC network environment)
Corrections & Enhancements 27 Feb 1996
Latest revisions: 21 January 1997