When I press TAB key in command window, the tab character (spacing) is inserted instead of iterating trough items in current directory. How can I make it work this other way (autocompletion)?
4 Answers
It looks like completion may be disabled in the Registry.
There's an explanation below, from the output of cmd /?
:
File and Directory name completion is NOT enabled by default. You can enable or disable file name completion for a particular invocation of CMD.EXE with the /F:ON or /F:OFF switch.
You can enable or disable completion for all invocations of CMD.EXE on a machine and/or user logon session by setting either or both of the following REG_DWORD values in the registry using REGEDT32.EXE (actually, just regedit.exe would be fine):
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar
and/or
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar
with the hex value of a control character to use for a particular function (e.g. 0x4 is Ctrl-D, 0x6 is Ctrl-F, 0x9 is Tab). The user specific settings take precedence over the machine settings. The command line switches take precedence over the registry settings.
If completion is enabled with the /F:ON switch, the two control characters used are Ctrl-D for directory name completion and Ctrl-F for file name completion.
To disable a particular completion character in the registry, use the value for space (0x20) as it is not a valid control character.
-
1You can also set both of these options using TweakUI: microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx Commented Mar 18, 2010 at 12:55
-
@njd, Why do you say that it's not enabled by default? It seems to be enabled by default for me (Win 8.1).– PacerierCommented Jan 23, 2015 at 15:29
-
@Pacerier It's not enabled by default in Windows XP, which is the version the OP was asking about. Also I wrote that in 2010 and Windows 8 didn't get released until 2012.– njdCommented Jan 23, 2015 at 17:28
-
@njd, Anyway, another oddity:
Ctrl-F
andCtrl-D
both cycles through files and folders. Basically they do the same thing, is that the behavior you have on win8.1 too?– PacerierCommented Aug 25, 2015 at 13:45 -
8Likewise, to set Tab as the completion character, set the values of both CompletionChar and PathCompletionChar to '9' (ASCII code for Tab in both decimal and hex).– MylesCommented Feb 27, 2018 at 13:58
To make TAB default for auto complete follow below
- open REGEDIT
- look for HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar
- change the value to 9
- restart the cmd
- That's it.
-
Worked for me! The value was 40 before, then I changed it to 9. I hope I didn't disable anything important thereby.– Lisa B.Commented Oct 11, 2021 at 8:35
For me I had to :
- right-click on the title bar
- select Properties
- check QuickEdit Mode under Edit Options
On my system, adding the /F option to the command-prompt link disabled tab completion, regardless of what value was given. If I don't give /F at all, I have tab completion; but /F:ON and /F:OFF both disable it.