Command Prompt for Windows

File Names and Wildcards

The WinOne® Command Prompt supports both long file names and wildcard characters. Long file names can only be used on a file system that supports long file names. In Windows NT this includes the NTFS and HPFS. Typically, long file names can including up to 255 characters. The VOL command displays particular information concerning a file system, such as the maximum number of characters allowed for a single file name.

Long file names can include space characters or special characters and more then one dot character. To specify a long file name that includes space characters or any special characters as a parameter to a command or program, then the long file name, including the drive and directory, must be enclosed in between double quote marks (ie. ' " '). For example :-


The use of double quote marks is necessary, otherwise a command would assume that many parameters have been specified when a file name or directory name includes space characters or the WinOne® Command Prompt would assume some other course of action depending on the special character encountered. When ever a file name or directory name contains space characters or special characters the complete path MUST be enclosed in double quote marks. For example, the following is incorrect :-


The WinOne® Cpmmand Prompt includes pseudo file name completion using the TAB key. When using the TAB key, double quote marks will automatically be inserted when an expanded file name contains space characters or special characters.

All long file names have an equivalent 8.3 file name, since DOS programs do NOT recognise file names that include more then 8.3 characters. For example, the short file name for "A LONG FILE NAME.TXT" is :-


There is no need to convert a long file name (as above) when the long file name conforms to the 8.3 file naming convention for DOS programs.

Wildcard characters allow a set of files that share a particular pattern to be grouped together and specified as a parameter to a command. Wildcard characters include both the star character (ie. ' * ') and the question mark character (ie. ' ? '). The star character will match zero or more characters in a file name and the question mark character will match a single character. Most users would be familiar with the use of these wildcards. For example :-

*.TXTSpecify all files that have a .TXT file extension.
*.*Specify all file in the current directory.
FILE?.TXTSpecify all file such as FILE1.TXT, FILE2.TXT, FILE3.TXT etc.

Dot characters in file names are treated just like any other character when used in a file name and the file extension simply becomes the group of characters after the last dot character in the complete file name. Wildcards are not only matched with long file names, but they are also matched with the equivalent short file names. This can result in a long file name being accepted as matching a wildcard pattern even though it did not, since the short file name matched the wildcard pattern instead. Consider the following examples :-

*Specifies all file in the current directory.
*.*Specifies all file in the current directory.
*.*.*Specifies all file in the current directory.
*.TXT.*Specifies all files that include .TXT. any where in a file name. Also includes any short file names that may match *.TXT
*~*Specifies all files that include ~ any where in a file name (both long and short file names). Due to the way long file names are mapped to short file names, *~* may result in matching many file names that are not intended.

Similarly, wildcards can appear anywhere in a file name. For example :-

*TXT*Specifies files that includes the characters TXT any where in the file name, including a file names extension.

Just as DOS programs do not understand long file names and require equivalent short file names to work, it should be no surprise that certain wildcards should be avoided when used with DOS programs. The last two groups of wildcard examples can lead to unexpected results when used with DOS programs and should be avoided. The WinOne® Command Prompt commands, both internal and external, will function as expected, but DOS programs do not recognise these wildcards under any operating system.

The limitations with long file names and wildcards, outlined in this section, are not unique to the WinOne® Command Prompt and they will arise with any Win32 program that use long file names and wildcards.