Shortcuts
A number of Dos commands recognise certain shortcuts when navigating between directories. The best known of these are:
| . | to refer to the current directory |
| .. | to refer to the parent directory |
| \ | to refer to the root directory of the current drive. |
| drive: | to refer to the current directory on drive |
Examples:
- 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
- If the current drive and directory is c:\data\docs\letters, then:
| Command | . | .. | ... | \ |
CD ChDir |
Nothing. 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:\ |
- If the current drive and directory is c:\, then:
| Command | . | .. | ... | \ |
CD ChDir |
Nothing - current directory stays as: c:\ |
Error message: "Invalid Directory" |
Error message: "Invalid Directory" |
Nothing. 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.
| Wildcard | Typical 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?.txt | All 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 (usually) that the last period separates "filename" and the "extension" - however long that "extension" may be.
|