Name Completion

Name Completion

When you are typing command lines to CMD, you often need to type file and folder names. Name completion makes this easier-you can type just the first few letters of a file or folder name, strike a control key, and CMD finishes typing the name for you. This is a nifty but not widely known feature that, like most of the other fun new features in CMD, Microsoft has borrowed from the Unix operating system.

Here's how name completion works: If you press the filename-completion character (usually the Tab key), CMD examines the characters to the left of the cursor and uses this as the basis for a path and/or filename.The way to think of this is that when you type the completion character, CMD looks for any files whose names start with whatever you've typed so far. If there is a space or nothing at all to the left of the cursor, CMD looks for * (all files).

If CMD finds no matching file or folder name, it beeps and does nothing. If it does find a matching name, CMD finishes typing the name for you. It looks like this:

c:\batchglt; ← edit b I type edit and the letter b, then press Tab
c:\batchglt; ← edit bills.bat CMD finds a matching file and completes the name

If this is the correct name, you can continue typing on the command line.This is a great timesaver! If the name that CMD types is not the one you are looking for, you can press the completion key again to see the next matching name. Pressing the key repeatedly cycles through all matching names.What's more, you can hold down the Shift key while typing the completion character to cycle backwards.

Tip: If you have to type a long pathname such as \Users\bknittel\Documents, you can use name completion for each part of the name. For this example, you could type the following:

dir \u (Tab) \b (Tab) \d (Tab) (Tab)

Try this on your own computer (and use your own username instead of bknittel). It's pretty slick- CMD adds the required quotation marks and moves them into the correct positions automatically.

Directory name completion works in an identical fashion, except that it matches only folder names. Name completion is enabled by default, but not directory name completion. If you're content enough to use the Tab key to cycle through both filenames and folder names, just leave everything as it is. If you want to use a separate key to indicate that you want CMD to look only for directory names, I show you how in the next section.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值