O'Reilly logo

Pro Windows PowerShell by Hristo Deshev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.5. Tab Expansion: How Command Completion Works

Many UNIX shells and cmd.exe have provided file name completion for quite some time. Again, they did it in a way that reminds me of Henry Ford's saying about Model T car colors—customers can have a car painted any color, so long as it is black. PowerShell goes beyond the uncustomizable completion mechanisms of other shells by using the same approach as with prompt strings—it does its customizations through a global function that can extend tab completion. By default, in addition to file names, hitting the Tab key will complete cmdlet names, cmdlet parameters, variable names, and object properties. We can extend that by defining a global function and naming it TabExpansion. Let's first see how ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required