2

#PSTip Tab Completion in PowerShell 3.0

Note: This tip requires PowerShell 3.0 or above.

PowerShell’s tab completion just got better in v3. In addition to all its awesomeness, it is now capable of completing service or process names, event log names, module names and the list is long.

# event logs
PS> Get-EventLog -LogName

# services
PS> Get-Service -Name

# processes
PS> Get-Process -Name

There are many more new tab completion capabilities and features, and in this tip I would like to share with you two more less known locations where tab completion can help you discover possible values.

The first one is using a synthetic (calculated) property using the Format-* cmdlets. Just press the TAB key after the opening brace and you get completion for the hash table keys:

isetc1

The second one also works for hash tables. If you press the tab key in the Property parameter of New-Object, you get completion of the properties of the object you’re creating:

isetc2

Note that, in the ISE, you might need to press Ctrl+Space right after the opening brace to invoke Intellisense.

Filed in: Columns, Tips and Tricks Tags: , , ,

2 Responses to "#PSTip Tab Completion in PowerShell 3.0"

Leave a Reply

Submit Comment

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