Special Features in DOS |
|
Adding Parameters to a command |
|
A parameter is a letter typed after a command that tells the command to carry out an extra task. |
|
For instance, a command that we will find later in this section is the COPY command. This command copies files from one disk to another. The command with a parameter might look like this: |
COPY A: MEMO.TXT C:\ /v |
This part | Tells MS-DOS to |
COPY | Make a copy ... |
A: MEMO.TXT | .. of the file MEMO.TXT on drive A: ... |
C:\ | ... and put it on drive C: |
/v | and at the same time verify that the file is recorded correctly on C: |
|
|
|
Most parameters are optional, however you will discover, over time, ones that you use frequently. |
|
|
Special Features in DOS |
|
Set the Date and Time |
|
Most computers on campus have an internal clock that will automatically set the date and time for us when we turn the computer on. However, if our computer does not have this feature or our computer has two floppy drives, we 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 we do. It is important to periodically check the date and time if we have an internal clock to see if it is correct. If we have a two floppy system, it is important to enter the correct date and time when we turn the computer on. |
|
|
|
|
Special Features in DOS |
|
Check the Date and Time |
|
DOS will let us to 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. |
|
|
|
|
|
|
Special Features in DOS |
|
Change the Default Drive |
|
To change from our hard drive to a floppy drive, we 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:\> |
|
|
|
|
|
Special Features in DOS |
|
Diskcopy Command |
|
Sometimes there is a need to copy all the files on one floppy diskette to another floppy. First we will need a blank formatted disk. |
|
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 we 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, we will be prompted to write to another duplicate diskette(Y/N). Press N. |
5. Then we will be prompted to copy another disk (Y/N)? Press N. |
|
NOTE: |
If our 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: |
|
|
|
|
Special Features in DOS |
|
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 we 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 <insert filename here> 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. |
|
|
|
|
|
|
Special Features in DOS |
|
Comparing two diskettes |
|
We use the DISKCOMP command to check that two diskettes are EXACT copies of each other. |
|
NOTE: - |
They MUST both be of the SAME capacity i.e. 720Kb OR 1.44Mb |
|
It is usually used immediately after using DISKCOPY command to ensure that both copies are the same. DISKCOMP refers to the original diskette as the first diskette and the copy as the second diskette. |
|
If our computer has one diskette drive ( this is still normal!!) |
|
1. Type |
DISKCOMP A: A: {ENTER} |
|
2. When this message appears: |
Insert FIRST diskette in drive A: Press any key when ready... |
|
Insert the original diskette in drive A: and then press any key. |
|
3. When this message appears: |
Insert SECOND diskette in drive A: Press any key when ready... |
|
Remove the original diskette from drive A: and insert your copied diskette into drive A: and press any key again. |
|
4. When this message appears: |
Compare OK Compare more diskettes (Y/N) ? |
|
Type Y (for yes) to compare another diskette, N (for no) to exit from the DISKCOMP command. |
|
NOTE: - |
If the diskettes are NOT identical run the DISKCOPY and DISKCOMP commands again. |
|
|
|
|
Special Features in DOS |
|
Checking the Condition of a Disk |
|
We use the CHKDSK command to: |
• Check a disk to see how much space there is available, and how much is in use. |
• Fix some disk errors, such as files that show a non-zero size but that really have no data in them |
• Display information about the disk, including the total disk space, the number and size of files. |
• Display how much Random Access Memory (RAM) is available to MS-DOS. ( This is NOT the total memory in our computer!!) |
|
Run CHKDSK occasionally on all our disks to check for errors. |
|
The command: |
CHKDSK A: /F {ENTER} |
Checks the disk in drive A: for errors and fixes any errors it can. |
|
If CHKDSK finds no errors it displays a report like this: |
1213952 bytes total disk space |
|
87040 | bytes in 3 hidden files |
|
4608 | bytes in 6 directories |
|
1078784 bytes in 97 user files |
|
43520 | bytes available on disk |
|
655360 bytes total memory |
|
588480 bytes free |
|
|
If the CHKDSK command reports any errors on the disk, it displays a message such as: |
xxx lost clusters found in xxx chains and asks you whether you want to correct the errors. |
Type Y (for yes) and the press the {ENTER} key. |
|
NOTE:- |
This procedure can cause you to lose some of the information on your disk, however, not fixing the disk can cause you to lose even more!! |
|
|
|
|
Special Features in DOS |
|
Displaying the contents of a file |
|
The TYPE command enables us to display the contents of a file on our screen. |
|
NOTE: |
There are some files, for example, operating system commands or applications software, which we may not be able to read because they contain non-alphabetic and non-numeric characters. |
|
This command: |
TYPE APRIL.DOC {ENTER} |
Displays the contents of the file APRIL.DOC. |
|
If we want to display a long file, we can use the MORE command to display information one screenfull at a time. |
For example: |
TYPE APRIL.DOC | MORE {ENTER} |
|
Type pauses and displays the prompt --- More --- at the bottom of the screen, to view more, press any key. |
|
NOTE: |
The pipe ( | ) switch can usually be found by holding down the SHIFT key and pressing the backslash ( \ ) key. |
|
|
|
Special Features in DOS |
|
Wildcards |
|
Wildcards are symbols that enable us to perform an MS-DOS operation on more than one file at a time. A file specification that contains wildcards can refer to more than one file because it gives MS-DOS a pattern to match. |
|
MS-DOS searches for any file whose filename or extension matches the pattern. There are two wildcard characters: |
|
? | A question mark in a filename or extension means that up to a maximum of ONE character/letter/number can occupy that position. |
* | An asterisk in a filename or extension means that any number of characters/letters/numbers, (up to maximum of EIGHT before the dot, and up to a maximum of THREE after the dot) can occupy that position. |
|
|
NOTE:- |
There can be LESS than the maximum number of characters/letters/numbers. |
|
For example suppose you had a directory containing the following files, |
|
A.DOC AA.DOC AAA.DOC B.DOC A.TXT B.TXT |
|
The following command and file patterns match some or all the above files:- |
DIR *.DOC | Is the equivalent to DIR ????????.DOC and matches the first four files (those with the DOC extension) |
|
DIR *.* | Is the equivalent to DIR ????????.??? and matches ALL files. Use *.* with care e.g. DEL *.* deletes ALL files in the current directory, regardless of extension!! |
|
DIR ?.DOC | Matches A.DOC and B.DOC |
|
DIR ?.* | Matches A.DOC, B.DOC, A.TXT and B.TXT |
|
DIR A?.DOC | Matches A.DOC and AA.DOC |
|
DIR A*.DOC | Matches A.DOC, AA.DOC and AAA.DOC |
|
|
|
|
|
|
Special Features in DOS |
|
Help |
|
It can be used in two ways: |
1) HELP {ENTER} |
2) HELP {command help needed on} {ENTER} |
|
The first way will invoke the full list of MS-DOS commands that we can scroll through using the cursor keys and the TAB key, or point and click the command we are interested in for the opening screen and further details. |
|
The second method will take you straight to the commands opening screen of information, usually there are links to an Example page and a Notes page. The opening screen will give you the syntax for the command, for example the DIR command: |
|
Syntax |
DIR [drive:][path][filename] [/P] [/W][/A[[: ]attributes]][/O[[:]sortorder]] [/S] [/B] [/L] [/C] |
|
There then follows detailed explanations of what each parameter and switch does. A shortcut to find the parameters and switches available for most MS-DOS commands and many program names, is to add the switch /? after the command name. Even WIN the command to start MS Windows will give a list of possible switches that you could use. |
|
|
|
|
Special Features in DOS |
|
Input/Output Redirection and Filter Commands |
|
So far, we might have learned how to use some commands in their standard form, e.g. to display the content of a text file, to view a directory listing or to view the tree structure of directories. We can view the output directly on the screen. |
|
Using MS-DOS command in standard form, we type in our instruction at the command prompt, through the keyboard. It's a standard input. |
|
Then, MS-DOS will process your input and display the result on the screen. It's a standard output. Up to this point, the job is simply done. |
|
Now, if we want to record a directory listing for further reference or get a hard copy immediately, we need to instruct MS-DOS not to display the result on the screen but to save it to a file or print it out directly. It's called output redirection. |
|
On the other hand, if we want to process a job by using data on an existing file, we need to instruct MS-DOS to use data from a given file. It's called input redirection. |
|
In some cases, moreover, we may need to process a job by executing more than one command. By the way, the output from the first command will not be displayed on the screen but to be redirected into the input of the next command. It involves both output and input redirection. The logical connection betwwen these two commands is called piping. |
|
Piping is associated with filter commands: |
1. find, |
2. sort and |
3. more. |
|
|
They are called filter commands because they work much like a filter in a water system, which takes incoming water, changes it in some way, and sends it along the system (a good explanation from Van Wolverton's Running MS-DOS). |
|
The application of these filter commands are listed as follow. They can be used simply in an input redirection or through a logical piping connection. |
• Find searches input data for a text string. |
• Sort arranges input data in order. |
• More displays output one screen at a time. |
|
The following special characters are needed in Input/Output redirection and Piping: |
|
|
|
Examples |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
No comments:
Post a Comment