[Toc][Index]

Filename Completion


Filename Completion Keys: 
        F8                  Get the previous matching filename. 
         or Shift-Tab       
        F9                  Get the next matching filename. 
         or Tab             
        F10                 Keep the current matching filename and display 
                            the next matching name immediately after the 
                            current one. 
 
 Filename completion can help you by filling in a complete file name on 
 the command line when you only remember or want to type part of the name. 
 For example, if you know the name of a file begins AU but you can't 
 remember the rest of the name, type: 

 
         [c:\] copy au
 
 
 and then press the Tab key or F9 key.  CMD.EXE will search the current 
 directory for filenames that begin AU and insert the first one onto the 
 command line in place of the AU that you typed. 
 If this is the file that you want, simply complete the command.  If 
 CMD.EXE didn't find the file that you were looking for, press Tab or F9 
 again to substitute the next filename that begins with AU.  When there 
 are no more filenames that match your pattern, the system will beep each 
 time you press Tab or F9. 
 If you go past the filename that you want, press Shift-Tab or F8 to back 
 up and return to the previous matching filename. After you back up to the 
 first filename, the system will beep each time you press Shift-Tab or F8. 
 
 If you want to enter more than one matching filename on the same command 
 line, press F10 when each desired name appears.  This will keep that name 
 and place the next matching filename after it on the command line.  You 
 can then use Tab (or F9), Shift-Tab (or F8), and F10 to move through the 
 remaining matching files. 
 The pattern you use for matching may contain any valid filename 
 characters, as well as wildcard characters and extended wildcards.  For 
 example, you can copy the first matching .TXT file by typing 

 
         [c:\] copy *.txt
 
 
 and then pressing Tab. 
 If you don't specify part of a filename before pressing Tab, the command 
 processor will match all files.  For example, if you enter the above 
 command as "COPY", without the "*.TXT", and then press Tab, the first 
 filename in the current directory is displayed.  Each time you press Tab 
 or F9 after that, another name from the current directory is displayed, 
 until all filenames have been displayed. 
 If you type a filename without an extension, CMD.EXE will add *.* to the 
 name (* on HPFS drives).  It will also place a "*" after a partial 
 extension. If you are typing a group of file names in an include list, 
 the part of the include list at the cursor will be used as the pattern to 
 match. 
 When filename completion is used at the start of the command line, it 
 will only match directories, executable files, and files with executable 
 extensions, since these are the only file names that it makes sense to 
 use at the start of a command.  If a directory is found, a "\" will be 
 appended to it to enable an automatic directory change. 
 
 Appending Backslashes to Directory Names 
 If you set the AppendToDir .INI directive, or the "Add \ ..." option on 
 the Command Line 1 page of the OPTION dialogs, CMD.EXE will add a 
 trailing backslash [\] to all directory names.  This feature can be 
 especially handy if you use filename completion to specify files that are 
 not in the current directory -- a succession of Tab (or F9) and F10 
 keystrokes can build a complete path to the file you want to work with. 
 The following example shows the use of this technique to edit the file 
 C:\DATA\FINANCE\MAPS.DAT.  The lines which include <F9> show where F9 (or 
 Tab) is pressed; the other lines show how the command line appears after 
 the previous F9 or Tab (the example is displayed on several lines here, 
 but all appears at a single command prompt when you actually perform the 
 steps): 

 
         1    [c:\> edit \da <F9>
         2    [c:\> edit \data\
         3    [c:\> edit \data\f <F9>
         4    [c:\> edit \data\frank.doc <F9>
         5    [c:\> edit \data\finance\
         6    [c:\> edit \data\finance\map <F9>
         7    [c:\> edit \data\finance\maps.dat
 
 
 Note that F9 was pressed twice in succession on lines 3 and 4, because 
 the file name displayed on line 3 was not what was needed we were looking 
 for the FINANCE directory, which came up the second time F9 was pressed. 
  In this example, filename completion saves about half the keystrokes 
 that would be required to type the name in full.  If you are using long 
 file or directory names, the savings can be much greater. 
 
 Customizing Filename Completion 
 You can customize filename completion for any internal or external 
 command or alias.  This allows the command processor to display filenames 
 intelligently based on the command you are entering.  For example, you 
 might want to see only .TXT files when you use filename completion in the 
 EDIT command. 
 To customize filename completion you can use the Command Line 1 page of 
 the OPTION dialogs, or set the FileCompletion directive manually in your 
 .INI file.  You can also use the FILECOMPLETION environment variable.  If 
 you use both, the environment variable will override the settings in your 
 .INI file.  You may find it useful to use the environment variable for 
 experimenting, then create permanent settings with the OPTION command or 
 the FileCompletion directive. 
 The format for both the environment variable and the .INI file is: 

 
         cmd1:ext1 ext2 ...; cmd2: ...
 
 
 where "cmd" is a command name and "ext" is a file extension (which may 
 include wildcards) or one of the following file types: 

 
         DIRS       Directories
         RDONLY     Read-only files
         HIDDEN     Hidden files
         SYSTEM     System files
         ARCHIVE    Files modified since the last backup
 
 
 The command name is the internal command, alias command, or executable 
 file name (without a path).  For example, to have file completion return 
 only directories for the CD command and only .C and .ASM files for B (the 
 Boxer editor), you would use this setting for filename completion in the 
 OPTION dialogs: 

 
         FileCompletion=cd:dirs; b:c asm
 
 
 To set the same values using the environment variable, you would use this 
 line: 

 
         [c:\] set filecompletion=cd:dirs; b:c asm
 
 
 With this setting in effect, if you type "CD " and then pressed Tab, the 
 command processor will return only directories, not files.  If you type 
 "B " and press Tab, you will see only names of .C and .ASM files. 
 CMD.EXE does not check your command line for aliases before matching the 
 commands for customized file completion.  Instead, they ignore any path 
 or file extension information in the first word of the command, and then 
 search the FILECOMPLETION environment variable and the FileCompletion INI 
 directive to find a match that will limit the files selected for filename 
 completion. 
 
 Filename Completion Window 
 You can also view filenames in a filename completion window and select 
 the file you want to work with.  To activate the window, press F7 or 
 Ctrl-Tab at the command line.  You will see a window in the upper-right 
 corner of the screen, with a sorted list of files that match any partial 
 filename you have entered on the command line.  If you haven't yet 
 entered a file name, the window will contain the name of all files in the 
 current directory.  You can search for a name by typing the first few 
 characters. (Ctrl-Tab will work only if your keyboard and keyboard driver 
 support it.  If it does not work on your system, use F7 instead.) 
 See Popup Windows for information on customizing window position, size, 
 and color. 
 
 Filename Completion Window Keys: 
        F7                  (from the command line)  Open the filename 
                            completion window. 
         or Ctrl-Tab        
        ^                   Scroll the display up one line. 
        v                   Scroll the display down one line. 
                           Scroll the display left 4 columns. 
        >                   Scroll the display right 4 columns. 
        PgUp                Scroll the display up one page. 
        PgDn                Scroll the display down one page. 
        Ctrl-PgUp           Go to the beginning of the filename list. 
         or Home            
        Ctrl-PgDn           Go to the end of the filename list. 
         or End             
        Enter               Insert the selected filename into the command 
                            line. 
 

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs