0

#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:

pstip_tab_complete_properties_demo_01

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):

pstip_tab_complete_properties_demo_03

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

pstip_tab_complete_properties_demo_04

Filed in: Tips and Tricks Tags: 

Leave a Reply

Submit Comment

© 2017 PowerShell Magazine. All rights reserved. XHTML / CSS Valid.
Proudly designed by Theme Junkie.
%d bloggers like this: