23-02-2013, 01:00 PM
DOS Command
DOS Command.pdf (Size: 20.01 KB / Downloads: 20)
Introduction
Some course material on the Teaching Network may still use
the command line operating system called DOS (Disk
Operating System). This requires the user to type specific
commands at a prompt.
You may also need to use this system, for example, when
changing your password, and you can enter DOS by choosing
'MS-DOS Prompt' from the Public menu on the taskbar.
Commands can be typed in response to the network DOS
prompt:
G:\>
Commands may be typed in upper or lower case. Here, they
are specified in upper case to distinguish them from other
input.
Commands have a particular format. Some can be used
simply by typing the command name only, as in:
DIR
which displays a listing of files in the current directory.
Many commands can take extra information called
parameters to make them more specific, For example, the
COPY command can have a parameter specifying a file to be
copied and a parameter specifying a file to which the copy is to
be made. So the command would look like this:
COPY filea fileb
In this case, filea would be the name of a file to copy from
and fileb would be the name of a file to copy to.
Parameters can sometimes be omitted in which case a default
action will apply.
Commands can also be qualified by the use of options. Options
are preceded by a / sign. A simple example of the use of an
option is with the DIR command. DIR can be qualified by /P or
result in listings presented in a different format as detailed
later.
DOS Command Reference
Introduction
Command Format
Parameters
Options
DOS Command Reference
Some Useful DOS Commands
Make a copy of a file or merge files together.
COPY original-file destination-file
where original-file and destination-file are file
names, separated by a space.
The command can be used to merge several files into one file
since the original-file parameter can be a list of
filenames separated by the + symbol. For example:
COPY file1 + file2 file3
would copy file1 and file2 into file3.
Note that the file names used in the copy command must
include the file extension if it exists. So if you were copying a
fortran program called first.for, for example, you would
need to include the .for extension in the filename.
Delete a file.
DEL filename
where filename is the name of the file to be deleted. You are
asked to confirm that you really want to delete the file. Note
that the name must include the file extension.
The amount of space on a disk is limited and it is necessary
periodically to tidy up unwanted files. It is possible to use a '*'
character in a filename to match any sequence of characters.
This feature is very useful when deleting unwanted files with
identical extensions. For example, when developing
programs,
DEL
will delete every binary (.obj) file in the current directory.
Since an .obj file can always be recreated from the original
source program, it is usually unnecessary to keep it.
Obtain a list of the files stored in a directory.
If used without options this command will give a list of files in
the current directory, including any extension (e.g. .for), and
their size.
If used with the option /P, that is:
DIR /P
The same information will be displayed page by page with the
message:
DIR /W
the listing is of names and extensions only and in a more
compact format across the page.
Take a security copy of your working disk.
It is very important to have a second copy of your programs
and data in case you lose your disk or it becomes unreadable
for some reason. Use the DISKCOPY command as follows:
DISKCOPY
where A: denotes the drive the disks will be loaded into. When
a copy of your disk is generated in the computer's memory, the
computer tells you to remove the first or source disk and insert
the disk, which is to become the copy (the target disk).
Insert the target disk and press ENTER. If the second disk is
not formatted it will be formatted automatically. The source
disk should be write protected using the tab in the corner in
case you mistake it for the target disk (see the chapter on
using disks).