LABORATORY1
1. Use the dir command to list the contents of the root directory on the h: drive or any other drive drive except c: 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
11. Copy hello.txt to mysubdir. Use the mydir directory copy of hello.txt
h:\mydir\mysubdir> copy h:\mydir\hello.txt
Alternately 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
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 \mydir
Alternately 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.txt
Then check that it's gone
h:\> dir mydir
But 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
0 Comments