Tuesday, June 10, 2008

BASICS DOS TUTORIAL

Before you begin this tutorial, please make sure that your prompt is C:\> If it is not, please do the following:
Directions:
1. Type: c:
2. Type: cd..
This should place you into the C:\> working directory.
NOTE: DOS is not case sensitive; therefore, a command can be entered in with CAPITAL LETTERS, lower-case letters, or a MiXtuRe of the two.
Hardware and Software Differences
There are two parts to a computer system, the hardware and the software. Hardware refers to the physical components of a computer. An example of hardware components would be the monitor, keyboard and mouse. Software represents the programs which contain a set of instructions written to perform a certain task on the computer.
What is DOS?

DOS stands for Disk Operating System. DOS controls the computer’s hardware and provides an environment for programs to run. This system program must always be present when working with your computer.
Why You Need DOS
There are a variety of reasons why you need DOS. A few of them are listed below to satisfy your curiosity.
1. DOS controls the flow of information between you and the computer (translator).
2. DOS allows you to store information on your computer.
3. DOS allows you to retrieve information stored on your computer.
4. DOS interprets and translates the software you have on your computer.
5. DOS gives you access to all its function (i.e. saving, copying, and printing files).
Set the Date and Time
Most computers on campus have an internal clock that will automatically set the date and time for you when you turn the computer on. However, if your computer does not have this feature or your computer has two floppy drives, you will need to do the following steps to set the date and time.
Directions:
1. Type the date like this: 1-15-97
2. Press the return key (enter key).
3. Type the time like this: 8:46
4. Press return.
5. Notice that the C:\> prompt will appear.
DOS marks the date and time on everything you do. It is important to periodically check the date and time if you have an internal clock to see if it is correct. If you have a two floppy system, it is important to enter the correct date and time when you turn the computer on.
NOTE: Baynan sets the date and time for you automatically when you Login.
Check the Date and Time
DOS will let you check or change the date and time once it has been set. The procedure to do this is as follows:
Directions:
1. Type: date and press return.
2. If the correct date is displayed, simply press return. If the date is incorrect, type the correct date and press return.
3. Type: time and press return.
4. If the correct time is displayed, simply press return. If the time is incorrect, type the correct time and press return.
Directory Command
The DIRECTORY command is like a table of contents in a book. This directory will list the following information:
* Filenames
* File extensions
* Size of each file
* Date and time the file was last updated.
Directions:
1. At the C:\> type: dir and press return.
2. The list of files will scroll up and off the screen.
NOTE: At the end of the listing, there is a line that shows the number of bytes free on the hard drive.
Scroll Through the Directory Listing
When you type the DIR command and press return, the files begin to scroll vertically on your screen. If you have a lot of files it is difficult to read each one. By holding down the Control Key (CTRL) and the letter S at the same time, you are able to freeze the listing to view your files. When you are finished, press the spacebar for the list to continue.
NOTE: You must return to the C:\> before entering your next command.
Pause a Directory Listing
You can add a PAUSE command to your directory command which will allow you to view your directory one screen at a time.
Directions:
1. Type: dir/p and press return.
2. The screen freezes after it fills the screen with the files that are listed first in the directory.
3. Press the spacebar to continue listing you files.
4. Continue to press the spacebar until you return back to the C:\> prompt.
View a Wide Listing of Files
When you need to quickly view your files, you can add a /W to the directory command. This will display your files into five columns on the screen.
Directions:
1. Type: dir/w and press return.
2. DOS will list only the name of you file and the file extension on the screen.
NOTE: Use this command when you are not concerned with looking at the file size or the date it was created.
Recall a DOS Command
The F3 function key can be used to recall the last DOS command you typed in. If you would like to retrieve a previously entered command, you can also press the up arrow key continuously until you reach the desired command you were looking for.
NOTE: You can also type out each letter in your last command by using the right arrow key or the right cursor key. After you use the F3 key to recall a command, you can use the backspace key to edit any part of the command or add to your command.
Print a Directory Listing
You can print a list of your files in your directory by instructing DOS to send the information to your printer.
Directions:
1. Type: dir>prn and press return.
2. The > symbol stands for output. The PRN stands for printer.
NOTE: You can print a wide listing of your files by typing dir/w>prn
Laserjet printers and other sheetfeeder printers will not eject the page after the dir>prn command. You must take the printer off-line and press the form feed button. Remember to press the on-line button when you are done in order to continue using the printer.
Check for a Single File
Instead of using the directory command to look for one particular file, you can type the name of the file after the DIR command at the C:\> prompt.
Directions:
1. Make sure that you are at your C:\> prompt.
2. Type: dir format.com (filename.extension) and press return.
3. The screen will display a listing of the file or a file not found message.
Check for a Group of Files
The * symbol is referred to as a wildcard and stands for any character or group of characters. This is helpful when you want to list files that start with a particular letter or group.
Directions:
1. Type: dir c* and press return.
2. All filenames that begin with the letter C will be listed.
3. Press the F3 key.
4. Backspace twice and replace C* with A* and press return.
5. All filenames that begin with the letter A are listed.
List Files with the Same Extensions
You can also use the wildcard character * to look for a group of files with the same extension.
Directions:
1. Type: dir *.bat and press return.
2. All files with the .bat extension are listed.
3. Press the F3 key.
4. Backspace three times and replace the .bat extension with the .sys extension and press return.
5. All files with the .sys extension should now be listed.
Clear the Screen
When the screen get full of information, you may want to clear it. To do this, type CLS at the C:\> prompt and press return.
Create a File with DOS
Directions:
1. Type: copy con Quick.ltr and press return.
2. Type this message in the following format:
Bob
Sales are up 15%.
Good Job!
Craig
3. Press the F6 function key (^Z) and press return.
4. DOS gives you a message that 1 File(s) has been copied.
5. Type: dir q* and press return.
6. Now you can see the list of files beginning with the letter Q.
NOTE: You can also use the COPY command to print a file by typing: copy quick.ltr prn and press return.
Copy a File
You can use the COPY command to copy one file to another.
Directions:
1. Type: copy quick.ltr quick2.ltr and press return.
2. DOS will tell you one file has been copied.
3. Type: dir q* and press return.
4. You should have two files listed with different names.
NOTE: Filenames cannot be more than eight characters in length. File extensions cannot be more than three characters in length.
Copy a File with a New Extension
You can also use the COPY command to copy the file with a different filename extension.
Directions:
1. Type: copy quick.ltr quick.bac and press return.
2. Type: dir q* and press return.
3. Three files should be listed.
Type a File with DOS
If you need to check the contents of a particular file or any DOS file, you will need to use the TYPE command.
Directions:
1. Type: type quick2.ltr and press return.
2. DOS prints the contents of the file.
NOTE: Never use the TYPE command with files that have the .com, .exe, .sys, and .bas extensions. These are program files and will only display junk on the screen.
Rename a File
The RENAME command lets you rename a previous file with a new name.
Directions:
1. Type: ren quick2.ltr sales.ltr and press return.
2. Type: dir *.ltr and press return.
3. DOS lists only two files that have the .ltr extension: quick.ltr and sales.ltr.
Rename a Group of Files
With the wildcard character *, you can also use the RENAME command to change a group of files.
Directions:
1. Type: ren *.ltr *.bob and press return.
2. Type: dir *.bob and press return.
3. You should have two files listed with a .bob extension.
4. Type: dir *.ltr and press return.
5. There should be no files found with .ltr extensions.
NOTE: You can also rename a group of files that have the same name but different extensions. Type the RENAME command then the filename followed by the dot and the wildcard, space and then type the new filename followed by a dot and the wildcard character. It will look like this: filename.* newfilename.*
Create a Subdirectory
To create a subdirectory, you will need to use the MAKE DIRECTORY command, a.k.a. MD. The MD command is useful for organizing files on your hard drive. With subdirectories, you can create and store related files together. For example, one subdirectory could be used to store all word processing files and another for all spreadsheet files.
Directions:
1. Type: md \info and press return.
2. Type: dir *. and press return.
3. Notice the *. will list only the subdirectories.
Move to a Subdirectory
Once you have created a subdirectory, to move to that directory, you will use the CHANGE DIRECTORY command, a.k.a. CD.
Directions:
1. Type: cd \info and press return.
2. Type: cd and press return.
3. The name of the directory is listed.
Set the DOS Prompt
You can set or change the standard system prompt to display the name of the directory or subdirectory you are currently working in.
Directions:
1. Type: prompt $p $g and press return.
2. The DOS prompt tells you that you are working in the C directory (drive) and in the Info subdirectory.
3. Type: dir and press return.
4. The single dot stands for the current directory. The double dots stand for the parent directory (root). The dots are often referred to as place markers.
Move to the Parent Directory
DOS has a quick way to move from the current directory back to the parent directory.
Directions:
1. Type: cd.. and press return.
2. You will return back to the C:\> prompt.
Copy a File into a Subdirectory
The COPY command lets you copy files from one directory to another.
Directions:
1. Type: copy sales.bob \info and press return.
2. Type: dir \info and press return.
3. Notice that a copy of Sales.bob is copied into the subdirectory Info. The original file is also in the root directory.
Copy a Group of Files into a Subdirectory
When copying a group of files from the root directory into a subdirectory, it is necessary to use the wildcard character * along with the COPY command.
Directions:
1. Type: copy quick.* \info and press return.
2. DOS will list the files being copied.
3. Type: dir \info and press return.
4. Three files should be listed in the Info subdirectory.
List Files in a Subdirectory
The CHANGE DIRECTORY, a.k.a. CD, command will let you list files in your subdirectory from your hard drive.
Directions:
1. Type: cd \info and press return.
2. Type: dir and press return.
3. All files in the Info subdirectory are listed.
List Files in the Root from a Subdirectory
The DIRECTORY command is also used to get a listing of all the files in the root directory while in a subdirectory. The backslash character \ represents the root directory.
Directions:
1. Type: dir \ and press return.
2. All the files in the root directory are listed.
Select the Directory List
To look for a specific filename extension, you can use the SELECTED DIRECTORY command.
Directions:
1. Type: dir \*.bat and press return.
2. Only the files with the .bat extensions are listed.
3. Press the F3 key.
4. Backspace three times.
5. Type: sys and press return.
6. Now only the files with the .sys extensions are listed.
List Subdirectories
Directions:
1. Type: dir \*. and press return.
2. All the subdirectories are listed.
NOTE: The backslash character \ directs DOS to read from the root directory. The *. requests the listing of the subdirectories.
Delete a Single File
Periodically it is a good idea to delete files from the hard disk which are no longer needed or used. DOS makes it easy to remove these files with the DELETE command, a.k.a. DEL.
Directions:
1. Type: cd.. and press return.
2. The prompt shows you that you are back in the root directory.
3. Type: del sales.bob and press return.
4. Type: dir Sales.bob and press return.
5. Sales.bob is no longer listed because it has been deleted.
Delete a Group of Files
By using the wildcard character * you can delete a group of files from you hard Drive.
Directions:
1. Type: del quick.* and press return.
2. Type: dir quick.* and press return.
3. All Quick files have been deleted.
Delete all Files in a Subdirectory
There are two rules you will need to follow before removing a subdirectory.
RULE 1: All files in the subdirectory must be deleted.
NOTE: Never type DEL *.* when you are in the root directory. It will destroy all DOS files that are necessary to boot and operate the computer.
Directions:
1. Type: cd \info and press return.
2. Type: dir and press return.
3. Three files should be listed.
4. Type: del *.* and press return.
5. DOS will ask you if you are sure? (Y/N)
6. Type: Y and press enter.
Now that your subdirectory is empty, you can delete the subdirectory (see rule 2 below).
Remove a Subdirectory
RULE 2: You cannot be in the subdirectory that you wish to remove. You will need to return to the root directory (C:\> prompt).
Directions:
1. Type: cd.. and press return.
2. You should be back in the root directory.
3. Type: rd \info and press return.
4. Type: dir *. and press return.
5. Notice that the Info subdirectory is no longer listed.
Format a Floppy Disk
Before you can use a disk, you must format it.
Directions:
1. At the C:\> prompt type: format a:
2. The A drive will be the drive that you insert your disk into; hence, the a: after the Format command and press return.
3. You will be prompted with the message: "Insert new diskette for drive A: and press enter when ready."
4. Now insert the disk you wish to format and press return.
5. Once this formatting process is done, the following message will appear: "Format Completed." Then you will be prompted for a volume label. Simply press return again.
6. Now you will be asked if you would like to format another disk (Y/N)? Press N.
NOTE: If you receive a message like: "Track 0 bad" or "Disk unusable," your disk may be the wrong capacity. You can get help with this error message by typing:
Help Format.
Change the Default Drive
To change from your hard drive to a floppy drive, you will need to indicate this change as follows:
Directions:
1. Put a floppy disk into drive A.
2. Type: a: and press return.
3. Your prompt should change to A:\>
4. Type: dir and press return.
5. You are now able to see all the files on the floppy.
6. To change back to your hard drive, you will need to reverse this procedure.
7. Type: c: and press return. Now your prompt should be C:\>
Diskcopy Command
Sometimes there is a need to copy all the files on one floppy diskette to another floppy. First you will need a blank formatted disk (refer to section on formatting disks.)
Directions:
1. Type: diskcopy a: a: and press return.
2. When asked to put in the source disk, put in the diskette that has the information you want to copy into drive A and press return.
3. Wait a few seconds. When asked to insert a target disk, take out the diskette from drive A and insert the blank floppy disk and press return.
4. Once this process is complete, you will be prompted to write to another duplicate diskette (Y/N). Press N.
5. Then you will be prompted to copy another disk (Y/N)? Press N.
NOTE: If your machine has two floppy disk drives, insert the original (source) disk into drive A and the blank (target) disk into drive B. Then type: DISKCOPY A: B:
Copying a File from the Hard Drive to a Floppy Disk
Sometimes there is a need to copy a file from the hard drive onto a floppy disk. This is helpful if you would like to have an extra copy of a certain file as a backup or to transport the copied file to another computer.
Directions:
1. Type: copy a: and press return.
2. Wait for a few seconds, notice the red light on the floppy drive. Never attempt to remove a disk from the disk drive while this red light is on.
3. To check to see if the file was copied, type a: at the C:\> prompt and press return.
4. Type: dir and press return.