The display commands display the contents of files, the properties of files, lists of files, and Help files. They also organize displays into a sequence the user desires. This section will describe the procedures and commands available.
Windows Server 2003 primarily uses installed applications for file viewing. The Registry maintains a list of installed applications and attempts to match file extensions to appropriate software so that the file can be viewed in its native format. When you double-click a file name or icon in Explorer, the file opens within the application. If the file type is unknown, the Open With window is displayed, allowing you to select the application that should be used to open the file.
The WordPad applications that are part of the base Windows Server 2003 system allow the user to display and create text or ASCII files. These applications are accessed by selecting Start Programs Accessories WordPad.
From the command line, two commands are available for displaying files: more and type. The more command displays long files one screen at a time; the type command just displays the entire contents of a file and is usually used for short files only.
The cls command is used to clear the command prompt screen.
The more command displays long text files from within the command prompt window one screen at a time. Its basic syntax is
more [options] [file(s)]
Options for the more command are listed in Table A.30.
The file(s) parameter is not necessary when data is passed to the more command from another command using the pipe symbol ( | ). If it is used, it can be in the format of one or more file names, including the drive designation and path if necessary.
If the /e switch is used, the commands in Table A.31 may be used whenever the "—More—" prompt displays.
The type command simply displays the contents of one or more files and is similar to the UNIX cat command. Its syntax is
type file(s)
The file(s) parameter can consist of just the file names entered with the drive designation and path name if necessary. Multiple files in the file(s) list are separated by spaces. When entering a file name, remember to enclose it in quotes if it contains spaces.
Option |
Description |
---|---|
/e |
Enables the "extended" features that allow the user to control how the file is displayed by entering commands whenever the "—More—" prompt displays. The commands are identified Table A.31. |
/p |
Expands any form-feed characters. |
/s |
Consolidates multiple blank lines into one blank line. |
/tn |
Substitutes n spaces for each tab. |
+n |
Starts displaying the first file in the file(s) list at line n. |
Command |
Description |
---|---|
Space bar |
Displays the next page of text. |
ENTER key |
Displays the next line of text. |
f |
Displays the next file in the file(s) list. |
pn |
Displays the next n lines. |
sn |
Skips n lines. |
? |
Displays the commands that are acceptable at the "–-More—"prompt. In other words, the Help function. |
= |
Displays the line number. |
q |
Quits. |
Windows Server 2003 provides graphical and command prompt methods of displaying the file and directory hierarchy of a system and its network. The graphical methods are available through the My Computer window, Explorer, and the My Network Places. My Network Places, accessible either from its desktop icon or through Explorer, allows the user to display network files and directories.
This section describes the file and folder views available through Windows Server 2003 Explorer as well as the dir command that you can type in at the command crompt.
In Windows Server 2003 Explorer, the left pane of the Primary window (Figure A.2) shows the top level of the hierarchy for the desktop. Here directories have file folder icons and are referred to as folders. To view the subdirectories, left-click the box that contains a plus sign. When the subdirectories are displayed, the plus sign becomes a minus sign. To display both the files and subdirectories of a particular folder, select the folder by clicking it with the mouse. The folder contents will appear in the right pane.
To view detailed information about each file in the Contents of pane, select View Details from the menu bar. This detailed information includes the name of the file, its size in bytes, its type, the date it was last modified, and the attributes associated with it, which can be Archive (A), Read-Only (R), Hidden (H), System (S), or Compressed (C) (Compressed will display only on NTFS file systems).
Note that by default certain file types are omitted (or hidden) from the Explorer hierarchical display, such as system (.Ssys) and application extension (.dll). To automatically show all files or to view a list of the hidden file types, select Tools Folder Options View. Then select Show all files.
Files in the Contents of pane can be sorted for viewing by name, type, size, or date. To change this display sequence, select View Arrange Icons from the menu bar and choose the desired sort order.
There are two ways to view the properties and attributes of a particular folder. After selecting a file or folder in the Contents of pane, do the following:
Right-click or select File from the menu bar.
Select Properties.
In the Properties window, select the General tab.
Figure A.3 displays the General tab for a file using the FAT file system. If the NTFS file system were used, an Advanced Attributes option would also be displayed.
The dir command is available from the command prompt and gives the user the ability to display file and directory properties and attributes via the command line. Its default output display includes the volume label and serial number of the disk, a list of the contents of the current or selected directory, the number of files listed, the total size of the files listed, and the amount of disk space remaining. The listing for each file or directory includes its size in bytes as well as the date and time it was last modified. The file extension, if any, is displayed following the file name.
An example of a portion of the dir command output is shown in Figure A.4. Its syntax is
dir [file(s)] [options]
Neither file(s) nor options is required. Without these parameters, the dir command will simply display the default information for the current directory. The file(s) parameter can be one or more file names or directories. Its format can be just the file or directory name or the drive designation and path as well, using the standard syntax drive:path\filename; the wildcard characters * and ? may also be used (unlike early versions of DOS that require *.*). Separate multiple file names with spaces, commas, or semicolons.
Windows Server 2003 allows a user to create his own default results for the dir command through the dircmd environment variable. To set the default switches to be automatically executed whenever dir is entered at the command line, enter the following:
set dircmd=options
This action will bring up options available via any of the switches identified in Table A.32, which are considered the default until they are reset or Windows .NET is restarted. To override the default for a single command, enter a minus sign before the switch. For example, if the user enters the command set dircmd=/n and wants to see the shorter, wide listing for a directory that contains a large number of files, he enters dir /-n/w. Refer to the set command for more information regarding setting, overriding, and clearing environment variables.
Option |
Qualifier |
Description |
---|---|---|
/a |
:attributes |
Displays only those files that match the attributes listed. The default (which is without the /a switch) displays all files except those with the Hidden or System attribute set. The attributes qualifier is optional; when not used, the dir /a command will display all files, even hidden and system. The colon ( : ) is optional as well. Multiple attributes may be entered in any order as long as there are no spaces between them, but only files that match all of the attributes will be displayed. A minus sign in front of the attribute will display all files that do not match that attribute. Acceptable values are a (files that have the Archive or Backup attribute set), -a (files that do not have the Archive attribute set), d (directories only), -d (files only, no directories), h (hidden files), -h (files that are not hidden), r (read-only files), -r (files that are not read-only), s (system files), -s (nonsystem files). |
/b |
Prohibits display of any heading or summary information. Do not use in conjunction with the /w option. |
|
/d |
Displays the files/directories in columns, sorting by columns. |
|
/l |
Displays any unsorted files/directories in lowercase letters. |
|
/n |
Displays the following information for each file/directory: date and time last modified, whether the file is a directory, the size of the file, the name of the file or directory. This is the default format for the dir command. If the user wants the file names to display on the left, enter this option as /-n. |
|
/o |
:order |
Displays the files sorted in the order given. The default (without the /o switch) is to display the files/directories in the order stored. Using the /o switch without any order specified will display the directories sorted alphabetically, then the files sorted alphabetically. The colon ( : ) is optional. Values for order may be entered in any order and combination as long as there are no spaces between them, but the sort order will be defined by the order of the values, such that the first order value will be the primary sort key, the next one the secondary sort key, and so on. Acceptable values are d (sort in ascending order by date and time, oldest first), -d (sort in descending order by date and time, newest first), e (sort alphabetically by file extension), -e (sort in reverse alphabetical order by file extension), g (display with directories grouped before files), -g (display with directories grouped after files), n (sort alphabetically by file or directory name), -n (sort in reverse alphabetical order by name), s (sort in ascending order by size, smallest first), -s (sort in descending order by size, largest first). |
/q |
Pauses after each full screen of data. |
|
/p |
Displays only one screen at a time. Any key can be pressed to display the next screen. |
|
/s |
Displays all occurrences of the file name given in the specified directory as well as its subdirectories. Obviously, this option requires the file(s) parameter. |
|
/t |
:time |
Displays the selected time for each file, where time can be c for the creation time, a for the time the file was last accessed, or w for the time the file was last written. When used in conjunction with the /od or /o-d, it identifies the time field that is used for sorting. |
/w |
Displays the directory contents in wide format, which contains up to five columns of file/directory names. |
|
/x |
Displays the MS-DOS names for the files before the Windows Server 2003 names. Remember that the Server allows longer file names than the MS-DOS 8/3 character limit. The format of the display is similar to that of the /n option. |
|
/4 |
Displays four-digit years. |
For recursive listings, enter the following while in the root directory:
dir /s/n/o/p
This command produces a long alphabetical listing of all files, directories, and subdirectories, pausing at the end of each full screen of information. The directories display first, then the files.
To display files in the current directory that have both the Hidden and System attributes, enter the following:
dir /ahs
or
dir /a:hs
To simply display all files with a .doc extension in the current directory and its subdirectories, enter the following:
dir *.doc /s
Option |
Description |
---|---|
On |
Turns on the echo feature. In other words, displays (or echos) each command as it is executed. |
Off |
Turns off the echo feature. Typing echo off on the command line removes the prompt from the screen. |
Message |
Displays the message on the screen. This command is usually used in batch files following an echo off command. |
. (period) |
Displays a blank line. The syntax for this option is echo. with no space between the word echo and the period. |
The echo command is used primarily in batch files to either enable or disable the command echoing feature or to display a message to the screen. Its syntax is
echo [options]
Using echo without options will display whether the echo feature is turned on or off. See Table A.33 for options.
Windows Server 2003 provides both graphical and command-line methods of displaying Help documentation to the user. The graphical version is accessed from the Start menu by choosing Start Help as shown in Figure A.5.
Through the command line, the help command can be used to display Help information about Windows commands except net commands. The syntax is
help [command]
The parameter command is the name of the command for which you wish information. Omitting the command creates a display of each available command along with a brief description.
As an alternative to typing help and then the command name, the user can use the /? switch after the command. For example, dir /? and help dir will both produce the same Help information.
The net help command provides Help information for the Windows Server 2003 net commands. It has two acceptable formats:
net help [command]
and
net command {/help | /?}
The command parameter can contain one of three values:
A net command, such as net account, net start, net user, and so on.
The word services, which provides a list of network services the user executing the command can start.
The word syntax, which provides information on interpreting the syntax used within the net Help documentation.
The net helpmsg command provides the user with more information regarding a net error message. The syntax is
net helpmsg number
The number parameter is the number of the net error message. Net error messages are displayed in the following way:
NET ####: Message
where #### is the number included in the net helpmsg command.
Top |