Windows – How to use Cmd’s tab autocomplete effectively

bashcommand linewindows

I've used the Bash shell on Linux for years and I'm very fast with it. By frequently appealing for autocomplete by hitting the tab key, I'm able to write long commands in few keystrokes.

Recently at my job I've started using the Windows Command Prompt and Cmd. I'm very slow in Cmd. It has an autocomplete feature, but it works differently. I think I understand how it works, but I don't understand how to use it effectively, in fact it often slows me down. So I ask, how to use how to use Cmd's autocomplete effectively?

Let me give an example. First I'll describe how I use Bash, then how I try to use Cmd, and what goes wrong.

Suppose the folders in the current directory have names made from a continent and a country, eg. africa-nigeria, asia-india, europe-france, and that I want to change folder to europe-norway.

The way Bash's autocomplete works is that the tab key expands only if there is a unique expansion. Otherwise, nothing happens, but you can press tab a second time to list possible expansions.

So to move to Norway in Bash, I type cd and then make the following keystrokes:

  1. e tab for europe-
  2. n tab (nothing happens)
  3. tab again. It lists europe-netherlands and europe-norway as potential expansions.
  4. o tab for europe-norway.

Great! Thanks Bash.

However, when I try the same keys in Cmd, it expands e tab to europe-albania, which happens to be the first folder beginning 'e', but isn't the folder I wanted! What should I do now—is it possible to make Albania into Norway? Or must I cancel the command with Escape and type everything from scratch?

Best Answer

1 year update: I came to the conclusion that Cmd's autocomplete is unusable, and stopped using it.

I installed Clink which gives you Bash-style autocompletion in Cmd.

Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities

It's brilliant.