Automatic Completion with a Command Prompt

Can I use Automatic Completion with a Command Prompt in Windows 2000/XP/2003?

Yes. This article describes how to configure Windows 2000/XP/2003 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.

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.

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.

If you enable file and directory name completion by using /f:on, use CTRL+D for directory name completion and CTRL+F for file name completion.

When you press CTRL+D or CTRL+F, cmd processes file and directory name completion. These key combination functions append a wildcard character to string (that is, if one is not present), build a list of paths that match, and then display the first matching path. If none of the paths match, the file and directory name completion function beeps and does not change the display. To move through the list of matching paths, press CTRL+D or CTRL+F repeatedly. To move through the list backwards, press the SHIFT key and CTRL+D or CTRL+F simultaneously. To discard the saved list of matching paths and generate a new list, edit string and press CTRL+D or CTRL+F. If you switch between CTRL+D and CTRL+F, the saved list of matching paths is discarded and a new list is generated. The only difference between the key combinations CTRL+D and CTRL+F is that CTRL+D only matches directory names and CTRL+F matches both file and directory names. If you use file and directory name completion on any of the built-in directory commands (that is, CD, MD, or RD), directory completion is assumed.

To Activate Automatic Completion Permanently

Warning!

This document contains instructions for editing the registry. If you make any error while editing the registry, you can potentially cause Windows to fail or be unable to boot, requiring you to reinstall Windows. Edit the registry at your own risk. Always back up the registry before making any changes. If you do not feel comfortable editing the registry, do not attempt these instructions. Instead, seek the help of a trained computer specialist.

Click Start, click Run, type regedit, and then click OK.

Sponsored

To enable automatic completion for the current user, locate and click the following key:

Microsoft Registry

1

HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor

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.

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.

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.

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.

Note: 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.