XP/2K/2003: Filename or Directory Completion in Command Line

Posted August 29, 2004 by Quinn McHenry in Windows

The Windows command prompt has an autocompletion feature that allows those with a tendency toward laziness or efficiency not to type in a whole directory name or filename when issuing commands. This is perhaps most useful when you want to change into a directory such as Word Documents from June 2002 Through May 2004.

The basic command to enable autocompletion is as follows:

cmd /f:on

This can be run from an existing command window, or it can be used when starting a command window from Run. It can also be set to be done automatically in a shortcut to a command prompt by adding /f:on to the end of cmd in the shortcut.

Once autocompletion is enabled, you can complete a directory name or filename by typing one of the following:

CTRL-d complete directory name
CTRL-f complete filename
SHIFT-CTRL-d cycle through directory names in reverse
SHIFT-CTRL-f cycle through filenames in reverse

You can cycle through all of the directories or files in the current directory by repeatedly typing the various control characters above, or you can narrow down the list by typing the first few characters.

For example, to change into the directory My Documents, and if that is the only directory that starts with the letter M, then you can change into that directory by typing:

cd mCTRL-d

You will also see the directory name changed to “My Documents,” including the double quotes which are required.


About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.