您是否每天都使用命令提示符?(command prompt)如果是这样,我最近找到了一种通过简单的注册表编辑(registry edit)打开命令提示符(command prompt)自动完成的方法。输入长路径名时,只需输入前几个字母,然后按TAB即可自动完成文件夹或文件名(folder or file names)。
例如,如果我输入C:\Documents and Settings\,我只需要输入C:\Doc然后按TAB键。
如您所见,只有一个以“ doc ”开头的文件夹,因此它会自动完成并添加引号。现在这很整洁。如果您想进一步继续,只需 \在末尾添加另一个,然后按TAB。请注意,您可以在引号后添加正斜杠(forward slash),它仍然可以正常工作。
您只需按TAB 键(TAB key)即可继续浏览目录中的不同文件夹和文件。因此,如果您输入 C: 然后按住tab 键(tab key),您将能够按字母顺序循环浏览该路径中的所有文件夹和文件,即C:\Documents and Settings、C:\Program Files\等。
请注意,这实际上只适用于Windows XP。在Windows 7及更高版本中,当您按下(Windows 7)TAB 键(TAB key)时,自动完成功能将自动运行。
为命令提示符(Command Prompt)启用自动完成(Autocomplete)
第 1 步(Step 1):单击开始(Start),然后运行(Run)并在Windows XP中键入regedit 。在Windows 7及更高版本中,只需单击开始(Start),然后键入 regedit。
第 2 步(Step 2):导航到以下注册表项之一:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor
那你选哪一个?好吧(Well),这就是它的工作原理。Local Machine密钥将应用于计算机上的所有用户,但如果值不同,则将被Current User密钥覆盖。(Current User)例如,如果自动完成功能在HKLM 键(HKLM key)上被禁用,但在HKCU 键(HKCU key)上启用,那么它将被启用。当按下TAB 键(TAB key)只是插入一个 TAB 空格时,您可以判断是否禁用了自动完成功能。
您可以根据需要更改这两个位置的设置,但实际上只需要在HKCU 键(HKCU key)中启用自动完成功能。
第 3 步(Step 3):双击CompletionChar 键并将值更改为十进制格式的9。CompletionChar启用文件夹名称完成。
您还可以通过将PathCompletionChar的值更改为9来启用(9)文件名完成(file name completion)。请注意,十六进制的值 9(value 9)或 0x9 是使用TAB 控制(TAB control)字符进行自动完成。如果您愿意,也可以使用其他键。
例如,您可以将0x4用于 CTRL + D,将 0x6用于 CTRL + F。我个人认为TAB 键(TAB key)是最直观的键,但如果需要,您还有其他选择。
如果您愿意,您还可以对文件和文件夹完成(file and folder completion)使用相同的控制字符。(control character)在这种情况下,自动完成将显示给定路径的所有匹配文件和文件夹。
如前所述,在Windows 7 、Windows 8 及更高版本中, (Windows 7)HKLM 密钥中的(HKLM key)默认值为(default value)0x40(十进制为 64)。默认情况下,它应该在HKCU 密钥(HKCU key)中设置为 0x9(十进制为 9),这意味着它将被启用。如果没有,您可以手动去更改它。
总的来说,这对于必须输入大量DOS命令的人来说是一个很好的节省时间的方法。(time saver)如果您有任何问题,请随时发表评论。享受!
How to Turn On Auto-Complete in the Command Prompt
Do you use the command рromрt on a daily basis? If so, I recently found a way to turn on auto-complete for the command prompt via a simрle registry еdіt. When tуping in long path names, simply type in the first few letters and then prеss TAB to autocomplеte either folder or filе names.
For example, if I am typing in C:\Documents and Settings\, I would just need to type in C:\Doc and then press the TAB key.
As you can see, there is only one folder that starts with “doc“, so it automatically gets completed with quotes added. Now that’s pretty neat. If you want to continue further, just add another \ to the end and then press TAB. Note that you can add the forward slash after the quote and it will still work just fine.
You can continue through the different folders and files in a directory by simply pressing the TAB key. So if you type in C:\ and then keep pressing the tab key, you will be able to cycle through all the folders and files in that path in alphabetical order, i.e. C:\Documents and Settings, C:\Program Files\, etc.
Note that this really only applies to Windows XP. In Windows 7 and higher, autocomplete will work automatically when you press the TAB key.
Enable Autocomplete for Command Prompt
Step 1: Click on Start, then Run and type in regedit in Windows XP. In Windows 7 and higher, just clicking on Start and then type regedit.
Step 2: Navigate to one of the following registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor
So which one do you pick? Well, here’s how it works. The Local Machine key will apply to all users on the computer, but will be overridden by the Current User key if the value is different. For example, if autocomplete is disabled at the HKLM key, but enabled on the HKCU key, then it will be enabled. You can tell if autocomplete is disabled when pressing the TAB key simply inserts a TAB space.
You can change the settings in both locations if you like, but it is really only needed in the HKCU key for autocomplete to be enabled.
Step 3: Double-click on the CompletionChar key and change the value to 9 in decimal format. CompletionChar enables folder name completion.
You can also enable file name completion by changing the value of PathCompletionChar to 9 also. Note that the value 9 or 0x9 in hexadecimal is to use the TAB control character for autocomplete. You can also use other keys if you like.
For example, you can use 0x4 for CTRL + D and 0x6 for CTRL + F. I personally find the TAB key to be the most intuitive key, but you have other options if you need.
You can also use the same control character for both file and folder completion if you like. In this case, autocomplete will show you all matching files and folders for the given path.
As mentioned earlier, the default value in Windows 7, Windows 8 and higher is 0x40 (64 in decimal) in the HKLM key. It should be set to 0x9 (9 in decimal) in the HKCU key by default, which means it will be enabled. If not, you can manually go and change it.
Overall, this is a great time saver for anyone who has to type a lot of DOS commands. If you have any questions, feel free to post a comment. Enjoy!