//
stai leggendo...
domanda

Quick Hits: Finding, Creating and Removing PowerShell Type Accelerators

Learn Powershell | Achieve More

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].

image

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

image

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

Annunci

Discussione

Non c'è ancora nessun commento.

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

%d blogger hanno fatto clic su Mi Piace per questo: