en-us/about_TypeAccelerators.help.txt
TOPIC
about_TypeAccelerators SHORT DESCRIPTION The Type Accelerators module is a command line interface for managing type accelerators in the PowerShell session. LONG DESCRIPTION The PowerShell Type Accelerators Module contains four script Cmdlets: Get-TypeAccelerator, Add-TypeAccelerator, Remove-TypeAccelerator, and Rename-TypeAccelerator with the aliases gta, ata, rta, and rnta respectively. These allow you to control the type accelerators in your PowerShell session by adding or modifying them to suit your needs. The cmdlets output, with the exception of Remove-TypeAccelerator, objects of the type System.Collections.Generic.KeyValuePair[String,Type], but have had the properties Name and ReferencedType added that alias the Key and Value properties respectively in order to clarify their relationship. Remove-TypeAccelerator and Rename-TypeAccelerator will also accept these same objects on the pipline. As a refresher, type accelerators are built-in shortened .NET type names, such as the common [switch] parameter declaration which is short for [System.Management.Automation.SwitchParameter], that are stored in a dictionary that is loaded at the start of the session. EXAMPLES PS C:\> Add-TypeAccelerator -Name AList -Type ([System.Collections.ArrayList]) -PassThru Name ReferencedType ---- -------------- AList System.Collections.ArrayList This adds an accelerator for ArrayList mapped to [AList] as an accelerator. The PassThru parameter causes it to output the object added to the dictionary. The parentheses are required to send the type to the Type parameter. Alternately you could just send the type as a string and it would be cast to the type as well: PS C:\> Add-TypeAccelerator -Name AList -Type System.Collections.ArrayList PS C:\> Get-TypeAccelerator AList Name ReferencedType ---- -------------- AList System.Collections.ArrayList This command retrieves entries in the dictionary. PS C:\> Get-TypeAccelerator AList | Remove-TypeAccelerator This command retrieves the type accelerator entries and then sends them to the Remove-TypeAccelerator command. PS C:\> Rename-TypeAccelerator -Name AList -NewName List This command will rename your entry from [AList] to [List] PS C:\> Get-TypeAccelerator 'AList','BArray' | Rename-TypeAccelerator -NewName {$_.Name -replace '^','ps'} -PassThru Name ReferencedType ---- -------------- psAList System.Collections.ArrayList psBArray System.Collections.BitArray This command retrieves two of the entries and then, using RegEx supplied to the NewName parameter, will add the string 'ps' to the beginning of each name. KEYWORDS Type Accelerators SEE ALSO Get-Help Add-TypeAccelerator Get-Help Get-TypeAccelerator Get-Help Remove-TypeAccelerator Get-Help Rename-TypeAccelerator |