blank.gif (43 bytes)

Church Of The
Swimming Elephant




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 "Examples" screen.

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 with extensions.

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 file:

set dircmd=/w

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:

dir /-w

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:

set dircmd=

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

ntcmds00000001.gif Dir--Examples

ntcmds00000001.gif Dir


Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

Have you gone to church today?
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609