dos

5
1. Use the dir command to list the contents of the root directory on the h: drive h:\> dir 2. Invoke the MS-DOS full screen text editor utility EDIT to create a text file called hello.txt. Follow the instructions given on the screen. The "Survival Guide" gives instructions for using EDIT. h:\> edit hello.txt Enter the line Hello World! Use File|Save and File|Exit to save your work and to quit EDIT 3. Use the type command to display contents of hello.txt h:\> type hello.txt You should see Hello World! 4. Use the md command to create (make) a new directory called mydir h:\> md mydir 5. Use the cdcommand to change the default directory to mydir h:\> cd mydir 6. Use dir to display the contents of mydir. It should contain no files except for "pointers" to itself and it's parent. h:\mydir> dir 7. Use the copy command to copy the file hello.tx in the root directory to mydir. The target name defaults to hello.txt h:\mydir> copy h:\hello.txt 8. Use dir to display the contents of mydir. You should see hello.txt listed. h:\mydir> dir 9. Use md to create (make) a subdirectory for mydir called mysubdir. h:\mydir> md mysubdir 10. Use cd to change the default directory to mysubdir h:\mydir> cd mysubdir

Upload: fatima-ali

Post on 27-Oct-2014

39 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dos

1.    Use the dir command to list the contents of the root directory on the h: drive    h:\> dir

2.    Invoke the MS-DOS full screen text editor utility EDIT to create a text file called hello.txt. Follow the instructions given on the screen. The "Survival Guide" gives instructions for using EDIT.     h:\> edit hello.txt

Enter the line

    Hello World!Use File|Save and File|Exit to save your work and to quit EDIT

3.    Use the type command to display contents of hello.txt    h:\> type hello.txtYou should see    Hello World!

4.    Use the md command to create (make) a new directory called mydir    h:\> md mydir

5.   Use the cdcommand to change the default directory to mydir      h:\> cd mydir

6.    Use dir to display the contents of mydir. It should contain no files except for "pointers" to itself and it's parent.     h:\mydir> dir

7.    Use the copy command to copy the file hello.tx in the root directory to mydir. The target name defaults to hello.txt     h:\mydir> copy h:\hello.txt

8.    Use dir to display the contents of mydir. You should see hello.txt listed.     h:\mydir> dir

9.    Use md to create (make) a subdirectory for mydir called mysubdir.     h:\mydir> md mysubdir

10.    Use cd to change the default directory to mysubdir     h:\mydir> cd mysubdir

11.    Copy hello.txt to mysubdir. Use the mydir directory copy of hello.txt     h:\mydir\mysubdir> copy h:\mydir\hello.txtAlternately use ..  (two dots) to refer to mysubdir parent directory    h:\mydir\mysubdir> copy ..\hello.txt

12.    Make a second copy of hello.txt but call it hello1.txt     h:\mydir\mysubdir> copy h:\hello.txt hello1.txt

13.    Use the ren command to rename hello.txt as hello2.txt     h:\mydir\mysubdir> rename hello.txt hello2.txt

14.    Check your work - display the contents of mysubdir. You should see two files : hello1.txt and hello2.txt     h:\mydir\mysubdir> dir

Page 2: Dos

15.    Check that the contents of hello2.txt has not changed by displaying it.     h:\mydir\mysubdir> type hello2.txt

16    Using a wildcard delete all files in mysubdir. Be careful. Using wildcards in dangerous so hit N to cancel the command!     h:\mydir\mysubdir> del *.*

Instead use a wild card to delete all files with a .txt extension    h:\mydir\mysubdir> del *.txt  

Use the dir command to check that both files are gone    h:\mydir\mysubdir> dir

17.    Return to the mydir directory     h:\mydir\mysubdir> cd \mydirAlternately you could have typed cd ..

18.    Use the dir command to view the contents of the mydir directory.     h:\mydir> dir

19.    Use the rd command to remove the mysubdir directory.     h:\mydir> rd mysubdir

20.    Use the dir command to check that the mysubdir subdirectory is gone    h:\mydir> dir

21.    Return to the root directory     h:\mydir> cd \

22.    Delete the mydir copy of hello.txt     h:\> del \mydir\hello.txtThen check that it's gone    h:\> dir mydirBut the root copy of hello.txt is still there    h:\> dir

23.    Remove the mydir from the root directory     h:\> rd mydir

24.    And delete hello.txt from the root directory     h:\> del hello.txt

Ok, you are back where you started! Type    h:\> exitto close the MS-DOS command prompt window.

1. PRACTICING BASIC DOS COMMANDS In the procedure that follows, for those step requiring a DOS command, the command may be given, in which case it will be shown in bold and within brackets; for example [dir *.]. Type the command exactly as shown, but without the brackets, then press “Enter”. DOS commands are not case sensitive, so they can be entered in either upper or lower case. 1. Follow the instructor’s instructions to load a clean copy of the MS-DOS Operating System. 2. It is sometimes useful to know only directories (or folders) that are available on the drive.

Page 3: Dos

This can be accomplished using the DIR command. Type [dir *.]. 3. Record all the directories shown: 1) _________________, 2) _________________, 3) _______________ 4) _________________, 5) _________________, 6) _______________ 4. Change directory location, move into the DOS directory. [cd \dos]5. The prompt should now show the name of the directory you reside in. What is the prompt shown ____________________. 6. Obtain a directory listing of all the files in the DOS directory. [dir] 7. Did you notice that the listing scrolls off the top of the screen! You can control that by using the page option with the DIR command. Type the command [dir /p], the listing will stop when one screen is full. Press any key to list the next page. Continue until all 5files have been displayed, the DOS prompt will then appear. 8. Type the following command [dir /w]. The option /w stands for wide. 9. Finally, the two options can be combined. [dir /w /p] 10. Move back to the root directory. [cd \]. What is the prompt shown now? ____________________ . 11. Move into one of the other directories and obtain a directory listing of all the files in it. 12. Move back to the root directory (see step 10 above). 13. To find the version of DOS that you’re using, type [ver]. What version of DOS is installed? ______________________. 14. Using the help command. Type [help]. Navigate and become familiar with the various options available within help. 15. What is the command for displaying a directory listing? _______________. 16. List the first two examples given in the help section for the command format. a) _______________________, b) __________________ 17. How are the following character combinations interpreted by the prompt command? $P = ________________________________________________________ $G = ________________________________________________________ $D = ________________________________________________________ $T =_________________________________________________________ $V = ________________________________________________________ $N = ________________________________________________________Exit help. Using the mouse, pull down the File menu, and select Exit; Or, using the keyboard, press the following three keys [Alt-F-X 18. Change the prompt to show the date instead of the local directory. What is the new prompt? _______________________. 619. Change the prompt to show the current time. What is the new prompt? ________________________. 20. Change the prompt back to the original. 21. Display the default Path. [path]. What is the default path? _________. This is the location/s that DOS will look for files that are not in the current directory. 22. Change the default path to instruct DOS to look in the root directory, the DOS directory, and the Checkit directory. [path c:\;c:\dos;c:\checkit]. 23. What is the new path? ______________________________________.