ITEC 1011 A,B
Week 5 Lab Instructions
Oct 12,13 2000
- These labs are designed for the Gauss Lab. If your system
doesn't have the appropriate commands installed, you will need
to complete the work at York.
- NO MACINTOSHES!!! These are PC labs.
- Watch the subject lines in the e-mails!
- Labs received after midnight Sunday will not be accepted.
- To familiarize yourselves with the MS-DOS operating system.
- To prepare yourselves for use of DOS in next week's lab on JAVA
- To learn some simple DOS commands,
- To learn how to use HELP
- To learn about the DOS file structure.
- To manage files and directories in DOS
- To view and edit text files
- To learn about input/output redirection (piping)
How to do this lab
- This lab requires you to actually read through and perform all tasks. The questions that you will submit are hidden in the text of the lab.
- Open a Notepad file, and put your name and student number at the top. Save this somewhere in your local directory.
- Keep this file open, and when you encounter a question, type in a one or two word answer on a new line. (Remember to save!)
- When you are done, paste the contents of this file into an e-mail
addressed to firstname.lastname@example.org or
email@example.com with the subject line
oct15: lastname studentnumber. Remember to put it all
in lower case, with a space between the colon and the lastname
and between lastname and studentnumber.
- Submit the E-mail.
Introduction to MS-DOS.
this lab you will learn how to access MS-DOS so as to be able
to run programs by typing commands at what is called a
command prompt rather than clicking on
icons as in the Windows graphic environment. DOS stands for
Disk Operating System. It was the standard PC operating system
until 5 or so years ago. It did not allow for multitasking
(i.e., running more than one program at the same time) and
only provided a graphic environment when Windows (typically
Windows 3.1) was run in addition.
The workstations in the
Gauss Lab use the Windows 98 operating system. Windows 98
includes an abridged version of MS-DOS which you will learn to
access and use below.
Note that when you access your email, and type
% pine you are typing a command, pine,
at the Unix command prompt, %. Unix is another
operating system. You will learn more about it later this
Starting an MS-DOS prompt
- Click on START,
- Put the cursor on Program Files, and click on
- If you can't find the icon in step iii, click Run, and type "command" in the box that pops up.
- The MS-DOS command window will then open. The window will look
similar but not exactly the same as the one pictured below.
- Question 1: What does DOS stand for?
Simple DOS commands (ver, mem, vol, dir)
Click on the MS-DOS window to activate it.
Type the command ver
and press return. This will display the current version of the MS-DOS operating
system which you are running.
Type the command mem
and press return. This will display the amount of memory available to DOS.
This is not the total amount of memory in the computer, it is just the memory allocated to DOS.
Type the command vol and
press return. This will return the device or "volume" of the current directory.
Type the command cls and
press return. The screen will be cleared.
Getting help in MS-DOS.
- Previously, to obtain a list of commands in DOS you only needed
to type help at the command prompt. This feature is
not available in Windows 98.
- To get help on a specific command, type
(command name) /? at the command prompt and press return. For
example, to get help on the cls command type
cls /? . Do this now and the result will be similar
to what you see below. Make sure that you type
cls /? rather than help cls.
- Question 2:What does the prompt
command do? (you must use help to look this up--describe it using your
The file structure in DOS (dir, cd).
- In MS-DOS the "Current Working Directory"
is displayed as part of the command prompt.
- Each device on the computer is assigned
a letter by MS-DOS. This was discussed in a prior lab and won't be repeated here. To make the current
working directory your personal directory, type F:
and hit return.
- Notice that the command prompt changes to display the
new current working directory.
To view the files in the directory, type dir and press return.
The list of files in the current directory will appear.
Enter dir /w . The extra /w tells
the dir to use "wide list format" (hence the w). It is an example of what is called a switch.
- Type dir /? to see what other switches may be used with dir.
Change the current working
directory to the main hard disk C: .
To do this, enter C:. Observe that the command prompt changes. Also observe that the
we are not in the "root" of the (C:) device but are in a subdirectory.
To get to the "root" directory, give the command
\ and press return. Make sure that you
use the backslash \ instead of the regular slash / or it won't work properly.
Give the dir /w
command to see what files are in the root directory of the main hard disk.
The cd (change directory) command changes
the current working directory. To make the current directory temp
the command cd temp and press
Give the dir command to see what files are
in that directory.
To go back into the previous directory, give
the command cd ..
Creating and deleting directories (mkdir,
- The command for creating a directory
- Go to your home directory F:
To create the directory jj, give the command
- Use dir to verify it is there.
Make the jj directory the current working
directory by giving the command cd jj .
Use dir to verify that there
are no files in it.
Go back to the previous directory by using cd ..
To delete the directory, use
rmdir jj. It might ask (depending on the version of DOS) "
Are you sure you want to delete this directory?". Press "Y" and hit return.
- Verify that the directory is in fact deleted.
Viewing and editing text files (edit, type,
- In Windows, the text editor was Notepad. In MS-DOS, the text editor is the edit command. We will create a text file called
blah.txt in your current directory.
At the command prompt give the command edit
Type some text into the editor so there is something to save.
- Notice the words "FILE", "EDIT", "SEARCH" etc. across the screen. These are the command menus. These are activated using keystrokes.
To view the "FILE" menu, hit "ALT" and then "F" -- the highlighted letter in the word "FILE".
- Now you can see the menu. Hit "S" -- the highlighted letter in the word "SAVE" to save the file.
- To shut down the menu's, if you choose not to complete a command, hit "ALT" to return to text edit mode.
- Try and see what is in some of the other menus.
- Hit "ALT", "F", "X" to exit, and return to DOS.
- Use dir to verify that blah.txt is in your directory.
Another useful command is type, which
outputs a text file to the screen. Type type blah.txtto view the file you just created.
An analogous command is the more command.
This will display the ---- more ---- at the bottom of each screen full of text. This is useful for long files.
Copying, moving, renaming, and deleting
files (copy, move, rename, del):
The command for copy in MS-DOS is copy.
We will create a copy of the blah.txt called blink.txt Type
copy blah.txt blink.txt
- Check the directory and verify that the file was copied.
- Type more < blink.txt
and to verify that this is in fact the same file.
The move command in MS-DOS is like
copy except that the original file is destroyed.
Type move blink.txt
Use dir to observe that blink.txt
is gone, and there is a new file, blue.txt.
The command which deletes a file is del
- Remove blue.txt.
Type del blue.txt.
- Verify that this file is gone.
- In MS-DOS, the del command will delete both files
and EMPTY directories.
Redirection and pipes.
- Some commands generate output to the screen. It is possible to redirect the output
of a command into a file. For example, you could redirect the
output from the dir command into a file.
Go to the root directory of the hard disk
(C:). To do this, type C:
, and then give the command cd
Give the command dir > dir.txt
press return. The right angle bracket (>) tells the computer to send the
output of dir to dir.txt instead of the screen.
Use dir to observe that there
is a new file called dir.txt.
If you redirect output to a file that already
exists, the original is overwritten. To append redirected output to a file that already exists, use two
right angle brackets instead of one.
- Give the command dir F:
>> dir.txt and press return. This will
append the file listing for your personal directory to
that of the main hard disk.
Pipes are a variation of redirects: they allow
you to redirect the output of a command into another command.
- An example
of why you would want to do this is dir. Since the output
is long, we will "pipe" its output into more.
- Give the command dir
Files that end in .EXE or .COM are actually
Whenever you give a command such as dir, you running a program located on the hard disk somewhere.
As we learned earlier in the course, program files in MS-DOS (and hence
also in Windows) all end in the suffix .EXE or .COM. This is short form
for Executable or Command. In fact, there is a file called dir.com somewhere
which is run every time you type dir.
.TXT files are text files. Notepad saves files as this type. Various software manufactures create their own 3-letter "Extensions". For example,
Corel uses the extension .WPD for a "WordPerfect Document". When you look at a web page that displays using Adobe Acrobat, you are viewing a file of .PDF "Portable Document Format" type.
Go back into your personal directory F:
- Give the command
- A Notepad window will open
containing the blah.txt file. You can close it immediately: we don't need
it. It is also possible to omit the .EXE suffix and just type Notepad
- Question 3: What do .EXE and .COM mean?
A useful and interesting command is ping.exe.
This takes an internet URL as an argument and then returns the average
time required to reach that site through the internet. Type the command
www.yorku.ca . This will return the average
time required to access the York webserver from this computer.
- Now give
the command ping www.auckland.ac.nz which
is the University of Auckland in New Zealand. How much longer does it take
for the signals to reach around the world?
Another interesting command is tracert.exe
for trace route. This command also takes an internet URL for the argument
(like ping) and returns the actual route taken by packets over the internet
enroute to the server.
- Type tracert www.yorku.ca .
Packets don't have to travel far to the York webserver. Now do the same
for the University of Auckland.
- Question 4: How many computers do signals to the University
of Auckland have to go through before reaching there?
At the command prompt, give the command telnet
mailsrv.yorku.ca . A telnet window
- This is the same window that would open if you clicked the "E-Mail" icon in the Steacie lab.
- Use PINE to compose an e-mail to the TA.
If you have been following the instructions, you should have answers to 4 questions in your Notepad window.
- Paste the contents of this file (DO NOT ATTACH! -- If you don't
know what attach means, don't worry about it) into an e-mail
to firstname.lastname@example.org or
- Make the subject line oct15: lastname studentnumber
- Send it.