AutoComplete at the Command Prompt

Even if you're the type who loves typing operating system instructions at a keyboard, you probably like to save keystrokes whenever possible. Using AutoComplete is a way to avoid repetitive typing.

You're likely already familiar with the AutoComplete feature, as it rears its head in applications such as Microsoft Word, Excel, and Internet Explorer. For example, the AutoComplete feature of Internet Explorer saves keystrokes when typing frequently used text, such as names, addresses, and even entire URLs.

The Command Prompt also supports a form of AutoComplete, except it's not called AutoComplete. So I take back the title of this chunk. The actual title of the Command Prompt's AutoComplete is File and Directory Name Completion (FDNC). If you have a pen handy while reading this chapter, you should just scribble in that title instead; like AutoComplete, I was trying to save keystrokes.

At any rate, the File and Directory Name Completion is turned on by default when launching Cmd.exe. With File and Directory Name Completion enabled, you can just start typing the start of your text string and then use the Tab key to scroll through an AutoComplete list. FDNC (and yes, I'm using the terms interchangeably) uses the contents of the current directory to guess at possible completions for the text you've started to type.

For example, say you're in the C:\ directory, and there's a folder in it called Downloads, and another called Documents and Settings. Now, you want to quickly navigate to C:\Downloads and run a script that you just downloaded.

From the C:\ directory, type CD, a space, then D. Then, after typing the D, press the Tab key. You should see the "Documents and Settings" folder completed for you. That's the Command Prompt AutoComplete at work. Press the Tab key again, and you should get the suggested folder name of "Downloads." Now press Enter, and you have just changed the working directory to C:\Downloads with a minimum amount of typing.

Understand that if you were in the C:\ directory trying to use AutoComplete for a folder called \Downloads, but the \Downloads directory was a subfolder of the \Documents and Settings directory, the previous example wouldn't work. The Command Prompt's AutoComplete only makes suggestions using the current directory's contents.

Using the Command Prompt Buffer

Although it's not exactly the same thing as File and Directory Name Completion, the Command Prompt buffer is a close relative. The buffer stores a list of recently typed commands, keeping even the ones you've mistyped. You can access the commands in the buffer with the up and down arrow keys. When you reach the desired command, press Enter to execute the command again. Needless to say, this can be a huge timesaver when repeating a command like the following:

 net use p: \\netwaretree\ /u:brianculp. password 

Instead of retyping the whole thing to reconnect, you can just hit the up arrow and then Enter. In the paragraphs that follow, I'll show you how to modify the way that many commands are kept by the Command Prompt buffer.

You can modify behavior of the Command Prompt buffer, along with other Command Prompt characteristics, by clicking the Control Menu icon (that little C:\ button in the upper-left corner) and choosing Properties from the menu. The command buffer is governed by three selections from the Options screen:

  • Buffer Size. Click the spin box to specify the number of commands you can access again with the up- and down-arrow keys.

  • Number Of Buffers. Specify the number of command history buffers to use.

  • Discard Old Duplicates. With this enabled, the history buffers work more efficiently by not saving duplicate commands.

When you close the Properties dialog box, you will be given the choice to apply your changes to the current window only or to have them affect all future instances of the Command Prompt.

Spring Into Windows XP Service Pack 2
Spring Into Windows XP Service Pack 2
ISBN: 013167983X
EAN: 2147483647
Year: 2004
Pages: 275
Authors: Brian Culp © 2008-2017.
If you may any questions please contact us: