Windows Command Line Auto Complete
I was flipping through the Windows Registry Guide looking for something else, but came across a couple of registry edits that enable file and directory auto-completion at the windows command prompt:
HKCU\Software\Microsoft\Command Processor
CompletionChar REG_DWORD data
PathCompletionChar REG_DWORD data
The data is ASCII code for the key, and the ASCII code for the TAB key is 0x09. CompletionChar enables file name completion while PathCompletionChar enables directory completion. The registry values were already there on my Vista workstation but not on my XP test workstation. When I added the values and re-opened the command prompt I was able to use the TAB key to autocomplete files and directories. Just keep pressing TAB to move through the selections.
You can also use the TAB key to auto complete in PowerShell, but the registry edit is not required.
I couldn't find a group policy that enabled this setting, but you could use group policy preferences (if you have 200 to deploy the registry edit.
HKCU\Software\Microsoft\Command Processor
CompletionChar REG_DWORD data
PathCompletionChar REG_DWORD data
The data is ASCII code for the key, and the ASCII code for the TAB key is 0x09. CompletionChar enables file name completion while PathCompletionChar enables directory completion. The registry values were already there on my Vista workstation but not on my XP test workstation. When I added the values and re-opened the command prompt I was able to use the TAB key to autocomplete files and directories. Just keep pressing TAB to move through the selections.
You can also use the TAB key to auto complete in PowerShell, but the registry edit is not required.
I couldn't find a group policy that enabled this setting, but you could use group policy preferences (if you have 200 to deploy the registry edit.
Comments
-
HeroPsycho Inactive Imported Users Posts: 1,940I'd use PowerShell. DOS type commands can be used in Powershell, although sometimes you need to put some text strings in single or double quotes which takes a bit of getting used to, but it is worth it since Powershell can allow you to use piping and loops, etc., even with DOS type commands.
Here are a couple of good examples I leveraged it for DOS type commands...
http://amargesonlive.spaces.live.com/blog/cns!5B5CC132CB45A3E9!168.entry
http://amargesonlive.spaces.live.com/blog/cns!5B5CC132CB45A3E9!177.entryGood luck to all! -
Claymoore Member Posts: 1,637When I read the registry edit, my first though was this would be great for PowerShell. It's such a great idea that they thought of it already and PowerShell natively supports autocompletion. I never tried using the TAB before though, I just used abbreviations or aliases for the commands and typed out the rest.
-
Claymoore Member Posts: 1,637TweakUI lets you change this registry setting.
Yep, this setting was in the TweakUI chapter of the registry guide. The main point of the chapter was mapping the TweakUI settings to registry keys so you could script and/or deploy the changes without relying on TweakUI.
I spent a few years as an SMS admin where I packaged and deployed lots of software and custom scripts. All that work turned me into a bit of a registry junkie and I now I tend to make a lot of direct registry edits rather than using other tools to do it for me. This is probably the only place I would admit this, but I am actually excited about Group Policy Preferences in Server 2008 because I now have a better way to deploy all my little registry tweaks.