How To Use Automatic Completion with a Command Prompt in Windows XP (310530)



The information in this article applies to:

  • Microsoft Windows XP Professional
  • Microsoft Windows XP Home Edition

This article was previously published under Q310530
IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

IN THIS TASK

SUMMARY

This article describes how to configure Windows XP to complete file and folder names automatically that you type at a command prompt. This feature works by typing a control character that invokes the feature.

back to the top

To Activate Automatic Completion

For example, to change to the Program Files folder, you can type cd \pro control_character. Or, to display the contents of the Myfile.txt file, you can type type myf control_character. If there are multiple folders or files that match the characters you type, typing the control character again displays the next matching instance. When the correct folder or file is displayed, press ENTER to complete the command. If no folder of file matches the characters that you type, you hear a beep.

You can activate or deactivate this feature for a computer, for a user, or for only the current command session.

back to the top

To Activate Automatic Completion in the Current Session

To activate automatic completion for the current command session, type cmd /f. Then type CTRL+D to complete a folder name or CTRL+F to complete a file name.

To deactivate automatic complete, type cmd /f:off.

back to the top

To Activate Automatic Completion Permanently

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.
  1. Click Start, click Run, type regedit, and then click OK.
  2. To enable automatic completion for the computer, locate and click the HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor key.
  3. To enable automatic completion for the current user, locate and click the HKEY_CURRENT_USER\Software\Microsoft\Command Processor key.
  4. For folder name completion, double-click the CompletionChar value. Type in hexadecimal the control character that you want to use.

    For example, if you want to use the TAB key as the control character, the control character is 0x9 (type 9 as the value; Windows converts it to hexadecimal). If you want to use the same control characters that you use for a single command session, type 0x4 for CTRL+D and 0x6 for CTRL+F. You can use the same control character for both folder and file name completion.
  5. For file name completion, double-click the PathCompletionChar value. Type in hexadecimal the control character that you want to use.

    For example, if you want to use the TAB key as the control character, the control character is 0x9 (type 9 as the value; Windows converts it to hexadecimal). If you want to use the same control characters that you use for a single command session, type 0x4 for CTRL+D and 0x6 for CTRL+F. You can use the same control character for both folder and file name completion.
  6. Quit Registry Editor.
If you enable this feature for the computer, the feature is available to all users. However, you can deactivate the feature for any individual user, or you can use different control characters for that user than you applied to the computer. The user settings take precedence over the computer settings.

back to the top

Additional Information

Note the following differences between folder and file name completion:
  • The file name completion feature works on folders also because the feature searches for a complete path and matches against both file and folder names.
  • If you use the file-completion control character with a command that works only with folders (for example, the cd or rd command), only folder names are searched.
  • The folder completion feature matches only against folder names. This makes the folder completion feature faster for folder searching than the file name completion feature if there are both files and folders with matching strings.
back to the top

Modification Type:MinorLast Reviewed:7/15/2004
Keywords:kbhowto kbHOWTOmaster KB310530 kbAudITPro