DOS COMMANDS, SWITCHES, AND WILDCARDS


DOS has its own set of commands that are entered at a DOS command prompt to instruct the operating system to carry out specific instructions or tasks. DOS commands are defined as internal or external.

  • Internal DOS commands reside in the DOS file COMMAND.COM. They are the most commonly used DOS commands implemented at the DOS command prompt. Some examples of internal DOS commands are COPY, DIR, DEL, RD, and CLS.

  • External DOS commands are typically located in the C:\DOS directory. They are usually associated with running a program or a task. External DOS commands are most often associated with file extensions such as .COM, .BAT, and .EXE. External DOS commands are often implemented by more advanced users. Some examples of external DOS commands are DELTREE, ATTRIB, EDIT, and MEM.

You should be familiar with the important DOS commands and switches displayed in Table 23.2. Practice using these DOS commands.

Table 23.2: DOS Commands and Switches

Command

Function

Switches Used

ATTRIB

Displays or sets the attributes of a file

+R/-R,+A/-A,+S/-S,+H/-H

CD

Changes to another directory

\ Takes you to the root

CD.

Back up one directory level

COPY

Copies the files and directories

XCOPY

Copies file directories and subdirectories

/H Copies hidden files

/S Copies subdirectories

V Verifies each file copied

DISKCOPY

Copies the entire disk

DEL

Deletes a file

DELTREE

Deletes the directory, subdirectory, and files

TREE

Displays directory and subdirectory structure

| more View one screen

DIR

Displays all files in current directory

/P Pauses each screen

/W Displays wide view

MEM

Displays memory used and available

/C Detail memory list

MD

Creates or makes a directory

MOVE

Moves a file

RD

Removes a directory or subdirectory

REN

Renames a file

SETVER

Updates the current DOS version table

SYS

Makes a drive bootable by copying the three main system files to it; used to create bootable DOS disks

VER

Displays the version of DOS installed

Switches

Switches are symbols used in conjunction with DOS commands that instruct DOS to carry out specific functions, such as displaying a screen in wide view or pausing a screen after a certain number of lines have been displayed.

The most common switch is the forward slash (/). It is often used in conjunction with the DIR command. For example, if you enter “DIR /P” switch at a DOS or Windows command prompt, 23 lines will be displayed at a time. You can then press Enter for the next 23 lines to display, and so on. This lets you read what is listed one page at a time instead of watching many pages scroll by. If you enter the “DIR /W” switch, a wide view of the files in the current directory will be displayed to the screen.

A very useful switch to utilize in a DOS or Windows environment is the forward slash question mark switch (/?). When this switch is entered in combination with a DOS command, you are presented with a screen that displays all the switches that can be used with that DOS command, as well as the function of each. Figure 23.4 displays the DIR /? switch and its results at a Windows 2000 command prompt.

click to expand
Figure 23.4: The /? switch results displayed at a Windows 2000 command prompt.

Wildcards

Two wildcards used in DOS and Windows allow you to find or display multiple occurrences of similar file name associations. In other words, wildcards are used to find or identify common directories and files. DOS reserves the question mark (?) and the asterisk (*) to be used as wildcards. These wildcards can also be used through a Windows GUI at the command prompt or in Windows 2000 by selecting Start > Search > For Files or Folders, and then entering the required criteria in the Search for files or folders named selection box.

Asterisk (*): The asterisk symbol replaces the characters to the right of itself and finds all instances of the specified criteria. For example, if you enter “DIR *.*” at the C: prompt in DOS, all the files in the ROOT directory of C:\ are displayed. If you are in the C:\Windows directory and enter “DIR *.INI” all the .INI files in the C:\Windows directory are displayed.

Question mark (?): The question mark wildcard is similar to the asterisk, except that the question mark can represent only one character at a time for each question mark specified. For example, if you wanted to find all of the .INI files stored in the C:\Windows directory from a command prompt, you would enter the following:

C:\WINDOWS\DIR *.INI

To display the .INI files with up to three characters in the file name, enter the following:

C:\WINDOWS\DIR ???.INI




The A+ Certification & PC Repair Handbook
The A+ Certification & PC Repair Handbook (Charles River Media Networking/Security)
ISBN: 1584503726
EAN: 2147483647
Year: 2003
Pages: 390

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net