Learning MS-DOS Basics
DOS or Disk Operating System is the system software, which makes it possible for you the user to see a graphical interface. Without a Disk Operating System no application program would be able to run. Even in Windows 95 there is a DOS environment, but the interface, you the users commonly see is a graphical user interface. The reason you need to know the rather unattractive face of DOS is that as your PC skills grow you could be exposed to different PC environments, so it is an introduction to a different environment, with the expectation of bigger things to come. To cut a long story short, consider this as a History lesson.
Before the Graphical interface was common (Windows 95 & Windows 3.11), the PC users had to work in a DOS environment. They created folders and files and managed them through DOS.
For today's session, we will create a number of directories, some text files/documents using the DOS editor, make some changes in the files/documents within the editor. Move the files around, copy them in different locations and finally delete them. Then finally we will remove the directories, which were originally created. The exercise will be explained in steps as clear as possible (if unsure ask the tutor), it is however advised that you carefully read through the document at least once before attempting to start the exercise.
To get to the DOS screen, you need to re-start your computer in the DOS mode or environment.
Simply stated, begin by clicking on the Start button. Click on the option 'Shut Down'. You are presented with about 4 choices (3 normally), before you get all excited and start clicking away, please make sure that there is no floppy disk inside the 'A' drive. Now click on the option 'Restart the computer in MS-DOS mode?'
The machine hums and haws and comes up with a particularly unappealing screen. Welcome to DOS. The screen as you will observe is black with some lettering in white, and you can see something flashing. It probably looks something like this:
C:\Windows>_
The short white line (black here, because I don't have a fancy printer) after all the lettering is the thing (cursor) which is flashing and that is the place where the user, meaning you, get to write instructions or commands. This place is also known as the Command Prompt. As a user you are expected to type in the commands at the command prompt, so whenever you come across a type in…instruction, that means that you are to type in commands at the prompt.
To get a feel of the environment, type in ver at the command prompt, and press Enter, DOS does not do anything until you have pressed Enter, so every time you write a command, always press enter. ver is short for version, meaning that you have just asked the question, as to what version of the operating system you are working on, or looking at. After the answer, the command prompt gets ready for your next question or command.
To get a further feel of the environment, type in dir (at the command prompt). You may what to know what 'dir' stands for; it is short for directory. What you just did was issued instructions to see a listing of the directories and files in the 'C' drive. But it went by rather too quickly and you hardly saw any of the beginning directories (by the way, in DOS mode, directories are what is known in the Win95 environment as Folders) go by.
Fear not, there are two ways to slow the run away list.
One way is to type in dir/w, this displays the directories and files on the drive in columns, so that at least now you can see some semblance of normality. By adding a forward slash '/' and the letter 'w', you have just instructed the machine to show the listing in a wide screen format, something like a wide screen movie on your telly. The forward slash is called a switch this is used when there is a choice in a particular command or word. To see the full range of switches, type in 'help' at the command prompt (try to get your tutors attention at the same time), after you have finished your exercise.
The other way to see the directories and files is to type in dir/p, this displays the directories one screen at a time. The system then waits for you to press enter or any other key to show you the next screen, this goes on until the list is exhausted and you are presented with the command prompt again, awaiting your next instructions. In this instance you have used the switch with the letter 'p', which has instructed the machine to pause the display of contents on the screen until you are ready to move on.
You would have noticed that the prompt looks like this: C:\Windows>_ which means that you are in the C:\ drive and in the Windows directory/folder. To get to the C:\ drive or the root directory, you need to instruct your system to get to it. You do this by doing the following, type in cd.. cd stands for Change Directory, the two dots or the full stops at the end are indicating to the system that you want to go one step back, since you were only one step from the root directory so the logical one step back would be the root directory. Whenever you want to change the directory you have to use the 'cd' command.
Now that you are in the root directory, in other words the C drive, type in dir one more time. If the screen goes by too quickly, use one of the options to see the listing.
OK so you have seen the list of folders and all that in the C drive, and in the Windows folder, now what?
You get to change the drive. The drive you have been looking at is the C drive, now lets change over to the floppy drive (this would be a good time to put in your floppy disk, if you haven't already done so). To do this you need to type in at the prompt: a: , your command prompt changes to A:\>_ this indicates that you are now in A drive. Now we can start creating some files and folders, but before we do that we have to check what else is on the floppy disk. To do that you type in dir and check the listing. If there is no data on your disk there will be a message saying
Volume in drive A has no label
Directory of A:\
File not found
A:\>_
If you are using a disk which has some files on it you will see a directory listing showing all the files and folders.
So far you have been using a single command and pressing Enter. For the rest of the exercise please keep in mind that when you type in a command and give a file name, there has to be a space between the two. For instance in the next step where you will be creating a directory, after typing in the md command you need to put in a space and then the name of the directory. One more thing you need to remember is that the file name cannot be more than eight characters long. So when you make the directory keep it within that limit.
At the A:\>_ prompt type in md yourname. md stands for make directory, you are instructing the system to make a directory in the A drive in yourname. After you have done that you will see the A:\> prompt flashing again, so how can you be sure that the directory was created? You do a dir to see the listing.
The listing should state your directory's name and indicate that it is a directory by <DIR> in the second column and the date you created in the third column, and the time in the fourth column.
Now that you have a directory let us create a few more on the same level. Make sure that you are in your root directory of the floppy, which should show: A:\>_ type in md (space) and then Business. You have just created another directory called Business. Lets move on and make another one, make sure you are in the root directory. Type in md Friends. You have just created another directory called Friends. Do a directory listing and see if they are all present in the same level.
The next step is to create sub directories within the directories you have just created. To do that we will start with the directory with has your name. type in cd yourname the command prompt should look something like: A:\yourname>_ type in md Books this will create a directory called Books within your directory. Let us make one more directory, in your directory, and call it Albums. Do a directory listing to see that they are in place.
Let us get back to the root directory, which is A:\>. Now let us move into the other directory called Business. Create two sub-directories in it called 1997, and 1998. Do a directory listing to see that they are in place. Move back to the root directory.
From the root directory change to the directory called Friends. Create two sub-directories in it called Bdays and Letters. Do a directory listing to check your work. Move back to the root directory.
Let us have a look at the work done so far, graphically:
A:\ |
|
|
|
Kamran:\ |
|
|
|
Books:\ |
|
|
Albums:\ |
|
|
|
|
Business:\ |
|
|
|
1997:\ |
|
|
1998:\ |
|
|
|
|
Friends:\ |
|
|
|
Bdays:\ |
|
|
Letters:\ |
As an example of how the path works, to get to the sub-directory letters in the sub-directory friends you would be required to type in at the prompt:
A:\>cd friends and when you are in the sub-directory friends you would then type in at the prompt, which would then look like
: A:\friends>cd letters, which would eventuate in the following: A:\friends\letters> notice that the backslashes denote the path. The back slash \ is used to denote path, or tell the system where a certain file is located and how to get to it. A path is the course that leads from the root directory of a drive to the file you want to use.
Now to create some text files, and to do that you would need to use the DOS editor, which is a basic form of a notepad. Type in at the prompt edit, you will see the DOS editor open. Type in a few lines, use the ALT key to get to the menu bar. Save it with a meaningful name in your root directory (A). Create 2 more files in the similar fashion, and save them in the root directory. Exit the DOS editor. Do a directory listing of your root directory. The text files you have just created should be there. If you want to check the contents of the files you would type at the prompt type filename & enter, this would display whatever you have put in that particular text file.
You will now do a copy of the files from your root directory to the other directories, called yourname, business, and friends. The files will be copied one by one in the different directories mentioned. To do this you need to be at the root directory and type in the following command: one by one
A:\>copy filename.txt a:\business
A:\>copy filename.txt a:\yourname
A:\>copy filename.txt a:\friends
This will copy the files you chose in the directories.
You should end up with the 3 text files in the 3 directories mentioned. You should also still have the 3 text files in your root directory. Do a directory listing to confirm.
Now you should copy the 3 text files in the root directory one by one by placing them in the following directories, 1997, books and letters. To do this you need to be in the root directory. Type in at the prompt:
A:\>copy filename.txt a:\kamran\books you can do the same command for the other 2 files. Do a directory listing of the files in their proper directories.
You can also rename files while you are in the DOS mode. To rename the 3 files in the root directory, make sure you are in the root directory. Then type in the following at the command prompt,
A:\>rename filename.txt newname.txt type in the same command to change the name of the other 2 text files.
Now it is time to get rid of the 3 text files in the root directory. To do that you need to be in your root directory and type in the following A:\>del filename.txt this will delete one of the text files in the root directory. To delete the other 2 in a single command, you need to type in the following: A:\>del *.txt this will delete the other 2 text files. In this command you have used del which stands for delete. The other character you used was the
* which is used when there are a lot of files to be deleted, copied or moved.Now let us start removing the directories one by one, remember the directories have to be empty, i.e. there should be no files in them, you cannot be in that directory while you are deleting it, it is the equivalent of standing on a branch and cutting that branch itself. To do the directory deletion(s). You need to be in the root directory and check all the directories one by one, the ones which are empty can be deleted straight away. But remember you have to be out of the directory to do that. E.g. A:\kamran\>rd books this command will remove or delete the directory called books from the sub-directory kamran. rd stands for remove directory.
Once you have removed all the directories you created in the root directory. It is time to totally purge the disk, to make sure there are no nasties left, we will format the disk before using it elsewhere. To do that move to drive C by typing in c: once you are in C drive make sure you are in the root directory, the prompt should look like C:\> type in after the prompt C:\>format a:
This command enables you to completely clear all data you have put in on your floppy disk. A word of caution here, if you are unclear of the drive you are in or are not sure what this is all about, please ask the tutor (if there is one around).
If you decided to go ahead with the format, then the system would have asked you to insert a floppy disk into the drive and press Enter, the system then removes data, and shows you how much has been done, etc. Choose N or no for another format. Remove the floppy disk from the drive.
You can return to the normal Windows 95 screen by typing in exit at the C prompt.
To the Top |
To C2 page |