I saw a question recently that somebody asked on how to locate and create custom type accelerators without the need of the PowerShell Community Extensions (PSCX) and its type accelerator, [accelerator]. I quickly answered his question, but decided that this would make a decent article not only for everyone, but also for my own reference.
The quick synopsis of a type accelerator is that it is basically a shorthand type for a full .Net type such as System.Text.RegularExpressions.Regex in which the type accelerator is [regex].
As you can see, both accomplish the same thing, just [regex] is a lot shorter to work with. So how can we see all of available type accelerators using PowerShell? Just run the following command to see them:
$accelerators = [PSObject].Assembly.GetType('System.Management.Automation.TypeAccelerators') $accelerators::Get
I created a TypeAccelerator type and then use the Get property to show both the type accelerator as well as the…
View original post 272 altre parole