MS-DOS Instructions

GN120

MS-DOS Instructions


Directory Structure

Your home directory is H:\. This directory is the one you start with once you have logged in. This directory, as with all directories, can contain files or more directories. A directory contained within another directory is called a subdirectory. A schematic of a directory structure is shown in Figure 1.


Figure 1. Schematic representation of a disk directory structure. Icons labeled as sub are subdirectories and icons labeled as doc are documents. All documents and subdirectories are stored in the home directory in the order displayed. Note that any subdirectory can contain documents or another directory.

It is important to become familiar with the directory structure of any computer system. You will need to copy files from your home directory to a floppy disk for backup. The floppy disk drive, A:\, is the 3.5" floppy in the PC you are working on. Likewise, C:\ is the internal hard drive in the PC you are working on. Your home directory H:\ is storage space allocated to you on a central disk storage system maintained by the System Administrator. The H:\ storage is accessible from either the SUN's or the PC's. Regularly backup your important files on the A:\ drive.

Besides changing directories for the purpose of backup, there are other reasons to learn the directory structure. Often you will end in a directory other than your home directory when exiting an application. For example, when you exit from Windows, you will no longer be in your home directory. You will probably find yourself in C:\WINDOWS. The C:\ part of this path indicates that your are now in a new main directory, C:\. To access files stored in your home directory, you will need to change the directory or specify a complete pathname for the file.

Path's and Pathnames

DOS filenames can have eight (8) characters plus a three character extension. Example: NAME1234.EXT where NAME1234 is the filename and EXT is the extension. A pathname ends with a file name. A path ends with a directory or sub-directory name.

To switch between one directory and another, simply time the letter-colon combination for that directory . For example, if you are currently in C:\WINDOWS, typing H: and a return will change your main directory to H:\ and the prompt will now indicate H:\>. If you type C: and return, you will switch back to the C:\WINDOWS sub-directory. MS-DOS will remember your last active path in a given directory and will switch you to that path. To change paths, see the CD command below.

Wildcards can be used to designate a group of files in a DOS command string. For example, the command DEL *.TXT will delete all files that end with the .TXT extension. The two wildcards available are * and ?.

The * is a wildcard character that represents any group of characters. For example three files named JOEPETE.TXT, JOEJOE.TXT, and JOEBOB.TXT can be represented as JOE*.TXT. Likewise, three files JOEPETE.TXT, JOEJOE.XLS, and JOEBOB.DOC can be represented as JOE*.*. Any part of a pathname can be replaced by a wildcard.

The ? is a wildcard character that replaces a single character in a file name. For example, the files JOE.TXT and JOE.TXS could be represented as JOE.TX? in a DOS command string.

Commands

Note: Characters in {} braces are optional. Characters in [] brackets are not optional. Do not include either type of brackets when entering commands.

CD

Changes from the current directory to a new directory.

Syntax: CD {dirname}

Comments: Typing CD alone simply tells you the name of the current directory. To change to a new directory, a directory name must be specified. In the example given, the new directory is named dirname. CD will change to the directory only if the directory is farther down the directory tree (i.e. dirname is a sub-directory). To change to a directory that is at a higher level in the directory tree, specify the complete pathname which includes the main directory, directory and all sub-directories leading to the final sub-directory. An example path might be H:\classes\gn120\.

Alternatively, to change to a directory that is at a higher level in the directory tree, type CD.. (read: CD period period ). This takes you back one directory level. Also, CD\ takes you to the root or main directory. For every main directory, or disk drive, there is always an active path. You can specify the active path by entering CD {path}. Then any commands, such as COPY, that have only a drive specified (Example COPY A:\FILE.TXT C:) will use that default path. In the example given, if the path on C:\ had previously been set to C:\WINDOWS using the command CD C:\WINDOWS, a copy of the file A:\FILE.TXT would now be found in C:\WINDOWS.

CLS

Clears the screen.

Syntax: CLS

COPY

Copies files to another disk.

Syntax: COPY [d:]pathname1 [d:]pathname2]

Comments: If both files are in the working directory, you need to replace pathnames with filenames.

DATE

Displays or sets date.

Syntax: DATE {mm-dd-yy}

Comments: Typing DATE with no optional parameters specified displays the date.

DEL

Deletes a file or files.

Syntax: DEL [d:]pathname1 {/p}

Comments: Adding /p causes DEL to ask if you want to delete each file. The wild cards * and ? can be used.

DIR

Lists the files in a directory.

Syntax: DIR [d:]pathname1 {/p}{/w}

Comments: Adding /p causes DIR to type the directory contents one page at a time and then pause. Adding /w causes DIR to type the directory contents in a wide display format.

DISKCOPY

Copies the contents of one disk to another.

Syntax: DISKCOPY [d:1] [d:2]

FORMAT

Formats a floppy disk.

Syntax: FORMAT [d:]

Comments: Various parameters can be specified for this command to control the formatting process. If anything other than a 1.4MB or 720K disk is used, consult a DOS manual for the proper parameters.

MD

Makes a new directory.

Syntax: MD [d:]pathname

Comments: Pathname can specify a directory to create in an existing directory. For example, if the directory users exists, a pathname \users\pete creates a subdirectory pete in the directory users.

PRINT

Prints a text file.

Syntax: PRINT [d:]pathname

REN

Renames a file.

Syntax: REN [d:][path] filename_old filename_new

RD

Removes a directory.

Syntax: RD [d:][path]

TIME

Displays the time of day.

Syntax: TIME {hh:mm{:ss{.cc}}}

Comments: Typing TIME with no optional parameters specified displays the time. The characters hh represent hours, mm represent minutes, ss represent seconds, and cc represent centiseconds.

TYPE

Displays a text file on the screen.

Syntax: TYPE [d:]filename