Command shell auto-complete

Today’s trick is one of those things that those that know think everyone knows, and those that don’t know never get told about.  It is the ability to do auto-complete from a command prompt.

The command shell (you know, cmd.exe) has an awareness of file and folder structure.  You can use this to your advantage when you are getting around.  For example, if you are in c:\users and you want to change directories to \windows\system32 then all you need to type is “cd \wi” and then hit your TAB key.  The line should lengthen to be “cd \windows" thanks to auto-complete (unless you have some other root directory starting with the letters “wi”).  Now continue the command line by typing “\s” and hit TAB multiple times until “system32” comes up, then hit enter to actually change directories.  This little trick can be very handy to find directories when you can’t recall their exact names.  Try typing “cd \prog” to get “program files” to come up, then type “\” and just hit TAB until you get to the directory you want.  If you go past the directory you wanted you can either keep hitting TAB to loop through everything or you can hold shift and hit TAB to go through the directories and files in the reverse order.

This doesn’t work only on CD commands, it works for most command line things.  Next time you are in a directory of logs or such try doing “notepad” and then hitting tab until you find the log you want to open.

Spread the word and don’t look down on anyone who didn’t know the trick!