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|
- If the current directory on the c: drive is c:\data\docs\letters, then:
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:
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:\
||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:
|Nothing - current directory stays as: c:\
Current directory stays as: c:\
||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.
|*.*||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 that the last period separates the "filename" and the "extension" - however long that "extension" may be.
- In a newsgroup posting, Larry Weiss1 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 recognises " " 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.
|1||Larry Weiss||edit " " -or- erase " " strangeness?||alt.msdos.batch||01 Jun 2000|