Shortcuts and Wildcards



A number of Dos commands recognize certain shortcuts when navigating between directories. The best known of these are:
.to refer to the current directory refer to the parent directory
\to refer to the root directory of the current drive.
drive:to refer to the current directory on drive


  1. If the current directory on the c: drive is c:\data\docs\letters, then:
    dir c:
    at the a:> prompt will list the files in c:\data\docs\letters

  2. If the current drive and directory is c:\data\docs\letters, then:

    Current directory stays as: c:\data\docs\letters
    Change to parent directory: c:\data\docs Change to parent's parent directory: c:\data Change to root directory: c:\
    DIR Displays current directory: c:\data\docs\letters Displays parent directory: c:\data\docs Displays parent's parent directory: c:\data Displays root directory: c:\

  3. If the current drive and directory is c:\, then:

    Nothing - current directory stays as: c:\ Error message:
    "Invalid Directory"
    Error message:
    "Invalid Directory"
    Current directory stays as: c:\
    DIR Displays current directory: c:\ Error message: "Invalid Directory" Displays directories and extensionless files of current directory Displays root directory: c:\



Many Dos commands associated with file handling (eg. ATTRIB, COPY, DEL, DELTREE, etc.) accept the use of the "wildcards" (* and ?).

In general terms, * refers to multiple characters and ? refers to a single character in a file or directory name.

WildcardTypical interpretation
*.*All files with all extensions.
*letter*.*All files with "letter" anywhere in its name.
*smith.*All files with names ending with "smith" (or "Smith")
Test?.txtAll files named "test" + one character and with txt extensions (eg test1.txt, but not test-a.txt nor test.txt)
?e*.*All files with an "e" as second letter in their names

It should be noted that not all commands handle wildcards in exactly the same way. For example DIR * and DIR *.* are considered synonymous but DEL * would delete only files without an extension.

Note also that when using long file names, the concept of "filename + extension" becomes somewhat confused. If a file name contains more than one period, Dos assumes that the last period separates the "filename" and the "extension" - however long that "extension" may be.


Larry Weiss pointed out that " " (a space enclosed by inverted commas) is accepted as a valid file specification by EDIT and DEL - albeit in rather different ways.

EDIT will open a file using the name of the current directory. Thus if the current directory is D:\data\docs\letters,
EDIT " "
will create a file in that directory called "letters".

Actually, the number of spaces between the inverted commas can be anything from 1 to ? (over 15, anyway). If there are no spaces, EDIT displays an error message saying that it cannot open the file. A similar message is displayed if any path is included in the command.

DEL recognizes " " as *.* and will prompt for confirmation before deleting all files in the directory. As with EDIT, the number of spaces between the inverted commas does not seem significant but if there are no spaces an error message is displayed saying that a required parameter missing. Unlike EDIT, a path can be included and, if it is, no spaces between inverted commas are required. i.e. to delete all files in the current directory:
DEL ./"" works, but
DEL "" gives an error message.

COPY also sees " " as *.* and, like DEL, accepts a path with it. Unlike DEL, there must always be a space between the inverted commas, even when a path is included.

This page last revised:
January 1, 2003.