Docsity

DOS Tutorial-Computers and Operating Systems-Handout, Exercises of Operating Systems

Toggle sidebar
bg1
Basic DOS Tutorial
This tutorial covers the basic commands that you may find helpful for using the DOS command
prompt, as well as instructions on compiling C++ programs in it.
To open the command prompt, hold the windows key (see below) and press R, then type in cmd in
the Run dialog window, then press OK.
You should see something like this:
C:\Documents and Settings\Nadeem means that we are currently in the folder named
Nadeem, which is in the folder Documents and Settings, which is on the C drive/partition.
This is also known as the path of the Nadeem folder. File system navigation (folder navigation) in
command prompt is the same concept as windows explorer, but instead of double clicking, we
type in the name of the folder as commands. Common to both, it is only when we are in that
folder, that we are able to manipulate it (more so in windows explorer than in DOS).
The key keyword dir stands for directory, and it shows all the files and directories contained in
the current folder. The contained files and directories are displayed as a vertical list, with dates &
time of which it was last modified.
docsity.com
pf3
pf4

Partial preview of the text

Download DOS Tutorial-Computers and Operating Systems-Handout and more Exercises Operating Systems in PDF only on Docsity!

Basic DOS Tutorial

This tutorial covers the basic commands that you may find helpful for using the DOS command prompt, as well as instructions on compiling C++ programs in it.

To open the command prompt, hold the windows key (see below) and press R, then type in cmd in the Run dialog window, then press OK.

You should see something like this:

C:\Documents and Settings\Nadeem means that we are currently in the folder named Nadeem , which is in the folder Documents and Settings , which is on the C drive/partition. This is also known as the path of the Nadeem folder. File system navigation (folder navigation) in command prompt is the same concept as windows explorer, but instead of double clicking, we type in the name of the folder as commands. Common to both, it is only when we are in that folder, that we are able to manipulate it (more so in windows explorer than in DOS).

The key keyword dir stands for directory, and it shows all the files and directories contained in the current folder. The contained files and directories are displayed as a vertical list, with dates & time of which it was last modified.

This is the same as viewing the files in the ever-familiar windows explorer that you’ve grown so accustomed to. Just that in the command prompt, there are no graphical display, everything is in text form. Note that in the windows explorer, the Address bar contains the identical address as the command prompt ( C:\Documents and Settings\Nadeem ).

Say that in windows explorer, we wish to go into the My Documents folder, contained in the Nadeem folder, we would simply double click on the My Documents folder’s icon. In the command prompt, to change to a contained folder, we use the cd command, followed by the name of that folder. The cd command stands for “change directory”. The output should look like the following. Though the explorer will show all the content of the My Documents folder, the command prompt simply switch it to that folder without automatically displaying anything. To view the files, use the dir command described earlier.

In windows explorer, if we wish to go back to the Nadeem folder from the My Documents folder, we simply press the Up button as shown below.

*cd* As opposed to typing in cd.. multiple times to get to the C partition (C:), the *cd* command will jump you straight there.

dir /w A variation of the dir command, in which the files/folders are displayed horizontally, leaving out most of the information that the dir command would output. An easier way to view files of a folder that contains A LOT of files.

dir /p Another variation of the dir command. Try this with a folder that contains A LOT of files and see the results for yourself (easier than me explaining what happens and leaving you clueless).

exit This is pretty self-explanatory…

For getting help on the proper usage of any of the DOS commands, you can type the DOS command followed by ‘/?’ (forward slash and a question mark) on the DOS prompt. For example, you can type dir /? in order to learn all about the dir command and the various switches (or variants, as called previously).

To see a complete list of available DOS commands and their brief introduction, you may visit http://www.computerhope.com/msdos.htm

Note: In newer versions of command prompt, the slash / and backlash \ can be used interchangeably. But in the Windows filing system, the backslash is the proper character of use. Also, the [tab] auto completion feature was newly added in Windows XP, taking the idea from Linux’s command prompt (terminal). Windows filing system is NON-case-sensitive, so cd Test = cd TEST = cd test = cd test when entering.