#PSTip Tab complete properties

Tab completion is a well-known feature in PowerShell, which speeds up the process of typing and reduces the risk for typing mistakes. The feature can autocomplete things like nouns and parameters, as well as values for parameters if PowerShell knows what type of object the parameter is expecting. The first two has been around since version 2.0, while the latter was introduced in version 3.0.

A less known feature is that the -Property parameter of Select-Object and the Format- cmdlets has supported parameter value completion since version 2.0.

Let us have a look at this feature in action. In the first example run in the PowerShell ISE, we press Ctrl + Space to bring up the tab completion feature:


In the second example, we use the Tab key to invoke tab completion:

When using the Tab key, the feature also works in the console host (powershell.exe):


The PSReadLine module (included by default in Windows 10/WMF5 and later), also provides support for Ctrl + Space in the console host:


About the author: Jan Egil Ring

Jan Egil works as a Lead Architect on the R&D Team at Crayon, Norway. He mainly works with automation, and has a strong passion for PowerShell. Products and services he works with includes Microsoft infrastructure products such as Windows Server, System Center and Microsoft Azure. He is a multiple-year recipient of Microsoft Most Valuable Professional Award for his contributions in the Windows PowerShell and Cloud & Datacenter Management technical communities. He speaks regularly at user groups and conferences, such as Nordic Infrastructure Conference (NIC), PowerShell Conference Europe and PowerShell Summit. He is a co-founder of the Norwegian Microsoft Technology User Group (MTUG), which is an association of local MTUG user groups in Norway. He is also co-organizing the MTUG Script Club which focuses mainly on PowerShell. You can follow him on Twitter @JanEgilRing.

Related Posts

%d bloggers like this: