VIEWS: 7 PAGES: 8 POSTED ON: 11/6/2011
DPR355- Operating Systems Module 2 You need 2 "high density 3.5”" disks. Keyboard entries are shown in CAPITAL LETTERS. The “enter” key should follow them. Do not use any disks without checking them first with a VIRUS scanner. PART A Topic: Working with files Commands to learn COPY UNDELETE HELP ATTRIB COPY CON A0. Create a New Master diskette. (DISK 1) Type the following exactly as they appear, adding enter to each line printed in upper case. C: CD \DPR355 FORMAT A: SYS A: (Label the disk with your name or student number, the paper label on your disk should read DISK 1 along with your name, student number, and DPR355 section letter. Type COPY C:\DPR355\*.* A: (You will learn what the * and ? symbols are used for later in this lab) Create a New WORK disk (DISK 2) Format a disk as in step A0. The paper label should read DISK 2 along with your name,student number and DPR355 section letter. A1. File Copy Use the copy command to copy 2 files from DISK 1 to DISK 2 . If you do a DIR of disk 1, you will notice that COPY is NOT the name of a file on the disk like FORMAT. This is an indication that it is not a file. It is a internal command that is part of the System. Insert the new master disk 1 into the A: drive and type DIR /W followed by the ENTER key. The single 3 1/2-inch drive is default A: drive. However it can also be called B: drive. The computer will ask you to change disks. Type COPY ONE.TXT B: (The computer will prompt you to insert the disk for drive B:, this disk is called the target disk, or the disk you will copy your files TO. 1 DPR355- Operating Systems Module 2 The computer will then prompt you to insert the disk for drive A:, called the SOURCE disk, or the files you or copying FROM. A2. Type HELP (using your Disk 1.) and view the multi-page list of commands that DOS provides on line help. To use these help files for any command on the list you can type HELP followed by the command you require help for. Type HELP COPY and you can read all about COPYING FILES Type HELP DIR Two external files (commands) that you can see in the directory, called HELP.HLP and HELP.EXE are available as long as you have the two files on an active disk. A3. COPY is the internal command. With it we can copy files from one disk to another, rename them, join two more files together, and even create new files. A4. Check the directory of your disk 1 in the wide mode. You should see a file called DPR355. This is a course outline of the class. Type DEL DPR355 and check the directory to see if it has been removed. The space can now be re-assigned. If you now write some other file to this disk, the deleted file will be written over. However the file is still on the disk, only the first character of the file name has been changed to a code to tell the computer that it is no longer wanted. You can retrieve the deleted file as long as the file is intact. Type UNDELETE DPR355 and follow the instructions. You have to provide a missing first character of the file name (any character will do). Check to see if you have recovered the file. Try some other files to gain experience of deleting and undeleting. A5. Wildcards If you do not know the exact names of files, there are ways DOS helps you call up files. With DISK 1 still in the A drive type DIR ???.COM 2 DPR355- Operating Systems Module 2 and note the display. Repeat with DIR ????.COM and see the difference. Try typing DIR with ????.EXE ????.* *.COM then *.EXE and try to establish what the "?" and the "*" can do for you? A6. With DISK 1 still in the A drive, Type COPY DP?355 B: (note the ?) Check the directory of your own Work disk - DISK 2 for the file. What does the "?" symbol replace in the command line ? With DISK 1 still in drive A:, type COPY *. B: Check DISK 2 directory to see what files were transferred. What does the symbol "*" replace in a DOS command ? A7. Now change to your DISK 2 and Type DEL *.* /P (prompt) Be careful here, you are going to choose which files you are going to delete by typing Y or N. Keep COMMAND.COM and delete the rest. If you make a mistake you can use the UNDELETE command. A8. Attributes Files can have several characteristics that are called attributes that can make them HIDDEN, SYSTEM, READ ONLY, OR ARCHIVE FILES. There are seven different attribute possibilities. With your disk 1 Type ATTRIB +H DPR355 (ATTRIB is the name of an external command and must be available on the default disk.) Type DIR A: to check the directory of the disk to see what happened to DPR355. Try to see if you can find the DPR355 by using wildcards. Type DIR /AH to see the difference. (A for Attribute, H for Hidden files) Type DEL DPR355 note the message How can we delete this file ? Try it. A9. File extensions 3 DPR355- Operating Systems Module 2 Insert your class Disk 1 into drive A and type DIR /P to look at the names of the files. You will notice that the files names are up to eight characters long, and an extension of up to three characters long. Files containing commands usually have an extension of COM, or EXE. BASIC files have the extension BAS, etc. Text file can have extensions like DAT, DOC, TXT. or HLP, or none at all. Text (or ASCII files) files are not like word- processing files. Files generated with a word-processor contain all kinds of control characters other than just the keystrokes for text. A10. Creating files In step A3 you were told that the COPY command was the most powerful of the internal commands. We are now going to use it to create a simple file. Change disks and with DISK 2 in drive A: Type COPY CON NAME.TXT followed by the Enter key. The CON stands for the CONSOLE or the monitor. You are now going to type and save an ASCII file (text only) called NAME.TXT. Notice that the cursor has dropped down to the next line and is waiting for your input. Type your name, but before you press the Enter key check for errors because once you have "entered" it you cannot edit a line. (If you make a mistake, you can press CRTL+C to cancel) Continue with your student number, followed by the Enter key. When you have finished you must tell the computer that it is the end of the file (EOF marker). Press the F6 key and then press the Enter key, and you will notice a message telling you that it has saved one file. You could have entered the same EOF marker by holding down the Ctrl key and pressing Z (^Z, called control Z). Check the directory to see if your file has been saved. A11. With DISK 2 still in the A: drive, Type TYPE NAME.TXT and view your file. If you see something missing you cannot edit it with COPY CON. You must type it over again. COPY CON is not an editor and that is why it is used only for short files. We will use an EDITOR in the next assignment to create longer ASCII files. PART B Topic: About Batch files and Customising DOS Commands to learn COPY CON EDIT.COM CONFIG.SYS AUTOEXEC.BAT 4 DPR355- Operating Systems Module 2 BUFFERS= FILES= DEVICE= PROMPT PATH CLS ECHO ON / OFF B1. When DOS is booted up from your disk certain default settings occur that you may change. These settings are divided into two areas: Hardware, and Software. Changing both of these areas requires you create ASCII files. The file to customise hardware is called CONFIG.SYS, and is looked for by the system during boot up, before it loads the DOS file COMMAND.COM. The file CONFIG.SYS contains a set of instructions that is read line by line into the computer. This ASCII file is not called a BATCH file because DOS is not yet in the system to read ASCII files. But the file acts like a BATCH file. B2. Batch files. Files with the extension BAT are read in sequential order by the computer and acted upon. You can create a batch file to do any repetitive procedure. COPY CON or an EDITOR program creates batch files. B3. DOS provides an EDITOR. Change back to Disk 1 and find a file called MARTIN.DOC (DOC is short for documentation). Using the command MORE, display and read the documentation from MARTIN. (EDIT.COM is not a regular MSDOS file) Copy EDIT.COM to Disk 2 from Disk 1. B4. Using Disk 2 Type EDIT NAME.TXT and view your file from last lab work. It can now be updated. If you cannot find the file, go back to the previous lab work and create one with "copy con" and save with the F6 key. Now with the file under the control of EDIT add your address, or phone number. The INSERT key acts as a toggle switch to turn the character insert on or off. Press the F7 key (F1 if you didn't add anything), and accept the same name by pressing the Enter key (or change it). Check the directory again and see what EDIT has done with your file. B5. Create a batch file with EDIT to go to the A: drive and show the directory of the disk in the wide format and with all attributes, then clear the screen after you are finished with the display. The shorter the name the faster you can activate it. You should make small names that are meaningful. The files will run by typing just their file name without the extension, just like an external file does. With your Disk 1 in the A drive: 5 DPR355- Operating Systems Module 2 Type EDIT A.BAT (followed by return) Type the following to create a file called A.BAT A: DIR /W /A (Note the use of the two switches) PAUSE cls Save the file with the F7 key. Run the file by typing the letter A followed by the ENTER key. You should see the full directory listing of your disk 1, and when you are ready, clear the screen. This gives you a prompt at the upper left corner of the screen. (the PAUSE holds the screen until you touch any key) Type EDIT A.BAT You should have your file back to edit. Move the cursor down to the clear screen command before the "c" of the "cls" and press the ENTER key twice. You should have created two blank lines. In those two blank lines type CHKDSK a: PAUSE Save and run the file again. Batch files can be made to automate any keyboard entry. Two of them are used during boot up to automate the way your computer is set up for your own requirements. B6. Customising DOS With DISK ONE in Drive A Type COPY CON CONFIG.SYS (Enter) Type BREAK=ON (Press enter after each line) FILES=30 To make the disk drives copy better enter the following: Type BUFFERS=30 Each buffer takes 512 bytes of RAM so don't make it too large) The file should look like the following: COPY CON CONFIG.SYS BREAK=ON FILES=30 BUFFERS=30 You could save the file (F7) now but let's add to it. Newer versions of DOS are so large that they take up much needed room from the user area of RAM. If however you have external memory it is advisable to use it 6 DPR355- Operating Systems Module 2 to help save user area for your software applications. DOS provides some files that can be used in the CONGIG.SYS file to move DOS into "high" memory (above 640Kb). Using COPY CON and CONFIG.SYS, add the following lines at the beginning of the file. DEVICE=HIMEM.SYS DOS=HIGH,UMB DEVICE=EMM386.EXE These special files are 1. HIMEM.SYS manages the use of extended memory (above 1 Meg) and this instruction should precede any DEVICE commands in the CONFIG.SYS file 2. DOS=HIGH,UMB is a statement to make the DOS files take advantage of unused Upper Memory Block area to load some of the system instructions. 3.DEVICE=EMM386.EXE is a Device driver statement to load the external file EMM386.EXE. This file forces the system to simulates EXPANDED memory within EXTENDED memory. Some program takes advantage of this kind of expansion. A Device Driver is a hardware modifier instruction. End the file as you did before and save it on to your Disk one. This file will be different for every machine and user. The more complex your computer the longer the CONFIG.SYS file. It is better to use an editor for longer files. This file is activated only during boot-up, copying it to your disk does not make it active. If you re-boot the computer now you will see error messages because the system cannot find external files that you have requested. We will transfer them to disk two in following step. B7. The file to customise the way you see DOS on the screen is called AUTOEXEC.BAT (BAT is short for BATCH). Both of these files are batch files but DOS recognises the word BAT after the file COMMAND.COM has been loaded. After COMMAND.COM is loaded it looks for this special file. If it cannot find these two files, the minimum default settings are set. B8. On your disk 1 Type EDIT AUTOEXEC.BAT To open up a new file called AUTOEXEC.BAT on disk 1. You should see a blank page with the EDIT menu along the lower section. The first thing to customise is the PROMPT. The prompt is the A> that you see on the screen. At any time you can change it to any group of characters you like with the command PROMPT _______ (fill in the blanks) 7 DPR355- Operating Systems Module 2 On the next line you are going to inform the computer where to search for files if a file called up by your input cannot be found on the default directory. This is a PATH command. All areas on any disk that you call up must be separated by a semi-colon. Type PATH= A:\;A:\UTIL;A:\TEMP This tells the computer three different areas to search on the disk, called subdirectories, that you will learn about soon. There are many more lines that you can include in this file, but the very last one that you can type could be very useful, because it can be used to call up a program to run every time you boot up. Mostly these are MENU type programs such as MANAGERS or SHELLS that help you navigate around large directories on hard drives. You will get to that later as you expand this disk. B9. Now that you have finished two simple customising files you can activate them by re-booting the computer. Do a Warm Boot and notice all the steps that are being changed in the system. Notice that the prompt has changed to A:\>. The backslash \ shows you that you are displaying the symbol of the "ROOT" of the default directory. Do not confuse the backslash with the forward slash "/" which is used for switches to modify a DOS command. These customised files will make your computer run a little smoother. As you continue into this course you will add to this file. Once you have seen this file work successfully you can include one more line at the start of the AUTOEXEC.BAT file. “@ECHO OFF” is a statement that stops the computer from displaying all the steps as it processes them, try adding it to your “AUTOEXEC.BAT” file as the first line and observe how the output changes the next time you reboot your computer. 8
"NAME SECTION DATE"