Command Syntax

Syntax is the order in which you must type a command and the elements that follow the command. Commands have up to four elements: command name, parameters, switches, and values. In the following illustration, the first example lists all hidden files in the C:\LETTERS directory. The second example allows up to 10 users to connect to the C:\USERS\PUBLIC directory.

Besides these four elements, command symbols can be used to direct the output. Each element is explained below.

Command Name

States the action you want Windows 95 to carry out. Some commands (such as the cls command, which clears the screen) consist only of a command name. Most commands require more than a name. For all network commands, type net followed by a space and the command name, as in the following:

net config

Parameter

Defines or creates the object you want Windows 95 to act on. Windows 95 sometimes requires additional information, which you specify in one or more parameters after the command name. For example, the del command requires a parameter that is the name of the file you want to delete. Some commands require more than one parameter. For example, to rename a file by using the rename (ren) command, you must include the original name of the file in addition to the new name. The following command renames LETTER.TXT to MEMO.TXT:

ren letter.txt memo.txt

Caution Some commands accept semicolons to separate parameters. For example, if you wanted to delete all files on drive A and typed del a;\*.* by mistake, Windows 95 would erase the file A in the current directory and all files in the root directory of the current drive.

Position in the syntax line determines how a command works and whether a parameter is a source (first) or a destination (second). In the example above, the source, LETTER.TXT, specifies the location of data to be transferred or used as input to a command. The destination, MEMO.TXT, specifies a location to which the data specified by source is to be transferred.

Switches

Modify how a command performs a task. A switch is a forward slash (/) or a hyphen (-), usually followed by words, letters, or numbers. Some commands do not have switches, whereas others have several. If a command has more than one switch, you type them one after the other, separated with a space. Switches can be in any position or order after the command name. Some commands accept more than one switch after a forward slash. Other commands, such as TCP/IP utilities, accept a hyphen (-) instead of the forward slash.

Tip The terms "parameter" and "switch" are often interchanged, since both elements follow the command name. The only meaningful difference between a switch and parameter is the presence of a forward slash or hyphen to indicate a switch and the parameter position in the syntax line to indicate whether the parameter is a source or a destination. The term "argument" is also used to refer to parameters or switches.

With some network commands for real-mode networking, Windows 95 presents a prompt that requires a user response before a task can be completed. Append the /yes (/y) or /no (/n) switch to a command to force a Yes or No answer for all responses. For example, stopping the workstation service causes Windows 95 to stop dependent services; Windows 95 prompts you before stopping each dependent service unless the /yes switch is included, as in the following:

net stop workstation /y

Value

Determines how a switch works. A value is a colon (:) or an equal sign (=), followed by a word, letter, or number and must immediately follow the switch it modifies without a space. The following example of the format command contains two values — the file system to use (VFAT in the following example) and a volume label (Backup2):

format d: /f:1.2 /v:backup2

Check the syntax for the specific command in online Help to determine whether the command you want to use requires an equal sign or a colon.

Command symbols

Direct the input or output of a command and permit conditional execution of a command. Used with commands and filter commands, the command symbols are powerful tools.

Symbol

Purpose

>

Redirects output.

>>

Appends redirected output to existing data.

<

Redirects input.

|

Pipes output.


Sort, more, and find are the built-in filter commands that work in the same way as command symbols, to allow you to sort input and output, cause output to the screen to be displayed one screen at a time, and search for specified text in a file.