http://www.lsi.upc.edu/~robert/teaching/foninf/doshelp.html#dir
Essential DOS Commands and Concepts
- Backup Files
- Change the Default Drive
- CHDIR (CD) Change Directory Command
- COPY Command
- DIR (Directory) Command
- ERASE Command
- File-Naming Conventions
- FORMAT Command
- MKDIR (MD) Make Directory Command
- Rebooting the computer (Ctrl-Alt-Del)
- RENAME (REN) Command
- RMDIR (RD) Remove Directory Command
- Stop Execution (Ctrl-Break)
Introduction
DOS (an acronym for Disk Operation System) is a tool which allows you to control the operation of the IBM PC. DOS is software which was written to control hardware. IDRISI, Atlas*GIS, Microstation, AutoCAD, CPS/PC, and ARC/INFO are, in turn, application software which run under DOS. By this we mean that, although IDRISI, Atlas*GIS, Microstation, AutoCAD, CPS/PC, and ARC/INFO were written to accomplish a single task or application (in this case manipulation of spatially related data), they must use DOS to pursue its work.DOS can be used for a wide range of tasks far beyond the requirements of this class. You will be able to manage well if you master only a small subset of DOS commands and functions. These relate almost exclusively to file and directory management and are introduced in this handout.
This tip sheet assumes that you have learned how to turn on the PCs as they are configured in room 230 and that you have familiarized yourself with their keyboards (no small task in itself). It also assumes that you understand the meaning of the concept of a file and the elements of a file specification (drive, filename, and extension). The microcomputers you will be using are equipped with two floppy disk drives. The A-drive is the 3.5" (1.44MB) drive and the B-drive is the 5.25" (360KB) drive. The microcomputers also contain a C-drive, a hard disk drive of 130MB or 200MB capacity.
You will quickly find that the best way to learn how to use a computer is through experimentation. That is, once you have learned a command, try some variations until they don't work, then start over. Often there are five or six ways for you to accomplish a particular task. Usually, I will introduce you to only one, leaving it up to you to discover the rest. Don't hesitate to consult the DOS Reference Manual; copies can be found on the bookcase in room 230. Finally, don't be unduly disturbed by error messages. With computers, one of the best ways to learn is by making mistakes.
Most of the common DOS commands you need to use for this class (copy, rename, delete) are available to you in Windows through the Filemanager icon. And, since you can move back and forth between DOS and Windows, it doesn't matter which option you employ. Some commands are faster in invoke in Windows, some in DOS. If you haven't worked with Windows previously, go to the Windows tutorials in the help area.
Backup Files
It is possible to lose files by mistake, although the more you practice the less likely it becomes. For your own peace of mind, it is good practice to make backup copies of your most valuable files on a separate diskette. Store your backup disk in a safe place and don't carry it through a metal detector. Use the COPY command to create the backup.There is no need to backup every file you create, only the ones in which you've invested much work. Also, prune your backup diskette every week or two using the ERASE command. Backup files which have been made redundant by subsequent additions will simply create clutter on your backup diskette. An effective file naming convention is essential to keeping track of your backups.
Change the Default Drive
To change the default drive, simply type the letter of the your choice. The new default will be listed in subsequent DOS prompts.Example:
- C> A: [enter]
- Changes the default drive from C to A.
- A> C: [enter]
- Changes the default drive from A to C.
CHDIR (CD) Change Directory Command
Once you have located the directory you want, you may move from directory to directory using the CD command (change directory)Example:
- C> cd furniture
- Moves you to the directory called 'FURNITURE'
- C> cd \furniture\chairs
- Moves you to the directory called 'CHAIRS' under the directory called 'FURNITURE'.
- C> cd ..
- Moves you up one level in the path.
- C> cd \
- Takes you back to the root directory (c: in this case).
COPY Command
The COPY command can be used both to copy files from disk to disk or to create a second copy of a file on a single disk. (There are many more uses of the COPY command, but only the basic operation is discussed here.)Example:
- C> copy c:kermit.exe a:
- Copies the file 'KERMIT.EXE' from the C drive to the A drive and gives it the same name.
- C> copy a:brazil1.dat b:\south\brazil2.dat
- Creates a copy of 'BRAZIL1.DAT' from drive A on drive B, putting it in the 'SOUTH' subdirectory and renaming it 'BRAZIL2.DAT'.
Example:
- C> copy a:myfile.txt b:
- C> copy c:command.com b:com.com
- C> copy b:golly.gee a:whao.boy
- C> copy command.* a:
- C> copy a:mymap.dwg c:\maps
DIR (Directory) Command
The DIRECTORY command lists the names and sizes of all files located on a particular disk.Example:
- C> dir a:
- Shows directory of drive A
- C> dir b:
- Shows directory of drive B
- C> dir \agis
- Shows files in a subdirectory on drive C (default)
- C> dir
- Shows directory of drive C
- C> dir /w
- Shows directory in wide format, as opposed to a vertical listing.
DIR Options
Two little characters, '*' and '?', will make your life with computers much easier. Their use is illustrated below.Example:
- C> dir a:*.ex
- Lists all files on the A drive with an extension of 'EXE'.
- C> dir b:kermit.*
- Lists all files on the B drive with a filename of 'KERMIT'.
Example:
- C> dir a:labe?.com
- Lists all five-letter files with the first four letters 'LABE' and an extension of 'COM'.
- C> dir b:format.c??
- Lists all files with a filename of 'FORMAT' and an extension beginning with 'C'.
Example:
- C> dir a:labe?.*
- Lists all five-letter files with the first four letters 'LABE' and any extension.
- C> dir c:*.ex?
- Lists all files with an extension beginning with 'EX'.
ERASE Command
The ERASE command deletes specified files.Example:
- C> erase a:myfile.txt
- Erases the file MYFILE.TXT from the diskette in the A drive. If no drive specification is entered, the system looks to delete the specified file form drive C (in this case).
BEWARE: I will rescind your laboratory privileges for a full week if you ever knowingly use either the command: erase c:*.*, or the command: erase *.*. Guess what happens?
File-Naming Conventions
Careful file naming can save time. Always choose names which provide a clue to the file's contents. If you are working with a series of related files, use a number somewhere in the name to indicate which version you have created. This applies only to the filename parameter; most of the file extension parameters you will be using are predetermined (or reserved by DOS for certain types of file).Example:
- WORLD.DAT
- An ATLAS*GRAPHICS file containing data for a world map. The DAT extension is required by ATLAS*GRAPHICS.
- BRAZIL.BNB
- A boundary file of Brazil in binary form.
- BRIT1.DAT
- BRIT2.DAT
- BRIT3.DAT
- Three versions of a data file for a map of Britain.
FORMAT Command
You must format new disks before using them on the IBM computers. The format command checks a diskette for flaws and creates a directory where all the names of the diskette's files will be stored.Example:
- C> format a:
- Formats the diskette in the A drive.
- C> format b:
BEWARE: Executing the format command with a diskette which already contains files will result in the deletion of all the contents of the entire disk. It is best to execute the format command only on new diskettes. If you format an old diskette make sure it contains nothing you wish to save.
MKDIR (MD) Make Directory Command
This command creates a new directory.Example:
- C> mkdir mine
- Creates a directory called 'MINE'
Rebooting the computer (Ctrl-Alt-Del)
In some cases, when all attempts to recover from a barrage of error messages fails, as a last resort you can reboot the computer. To do this, you press, all at once, the control, alternate and delete.BEWARE: If you re-boot, you may loose some of your work--any data active in RAM which has not yet been saved to disk.
RENAME (REN) Command
The RENAME command permits users to change the name of a file without making a copy of it.Example:
- C> ren a:goofy.txt pluto.txt
- Changes the name of 'GOOFY.TXT' on the A drive to 'PLUTO.TXT'.
RMDIR (RD) Remove Directory Command
This command removes a directory. It is only possible to execute this command if the directory you wish to remove is empty.Example:
- C> rd mine
- Removes directory called 'MINE'.
Stop Execution (Ctrl-Break)
If you wish to stop the computer in the midst of executing the current command, you may use the key sequence Ctrl-Break. Ctrl-Break does not always work with non-DOS commands. Some software packages block its action in certain situations, but it is worth trying before you re-boot.
Converted 20 July 1994. KEF.
No comments:
Post a Comment