Using wildcards with dir
You can use wildcards (? and *) to display a listing of a subset of files and
subdirectories. For an example illustrating the use of a wildcard, see the
Specifying file display attributes
If you specify the /a switch with more than one value in attributes, dir displays the names of only those files with all the specified attributes. For
example, if you specify the /a switch with the r and -h values for attributes by using either /a:r-h or /ar-h, dir displays only the names of read-only files that are not hidden.
Specifying filename sorting
If you specify more than one sortorder value, dir sorts the filenames by the first criterion first, then by the second
criterion, and so on. For example, if you specify the /o switch with the e and -s values for sortorder by using either /o:e-s or /oe-s, dir sorts the names of directories and files by extension, with the largest
first, and displays the final result. The alphabetic sorting by extension causes
filenames with no extensions to appear first, then directory names, then filenames
Using redirection symbols and pipes
When you use a redirection symbol (>) to send dir output to a file, or a pipe (|) to send dir output to another command, use the /a:-d and /b switches to list only the filenames. You can use the filename parameter with the /b and /s switches to specify that dir is to search the current directory and its subdirectories for all filenames
that match filename. Dir lists only the drive letter, directory name, filename, and filename
extension, one path per line, for each filename it finds.
Before using a pipe for redirection, you should set the TEMP environment
variable in your AUTOEXEC.NT file.
Presetting dir parameters and switches
You can preset dir parameters and switches by including the set command with the dircmd environment variable in your AUTOEXEC.NT file. You can use any valid
combination of dir parameters and switches with the set dircmd command, including the location and name of a file.
For example, to use the dircmd environment variable to set the wide display format (/w) as the default format, include the following command in your AUTOEXEC.NT
For a single use of the dir command, you can override a switch set by using the dircmd environment variable. To do so, you use the same switch on the dir command line, but you must also precede the switch letter with a minus sign,
as the following example shows:
You can change the dircmd default settings by typing the set command at the command prompt with a new parameter or switch after the equal
sign (=). The new default settings are effective for all subsequent dir commands until you use set dircmd again on the command line or until you restart Windows NT.
To clear all default settings, type the following command:
You can view the current settings of the dircmd environment variable by typing the following command:
Windows NT displays a list of environment variables and their settings. For
more information about setting environment variables, see the set command.
More Information About Dir