Setting aliases in Powershell 4

In Powershell, aliases are shortcuts for cmdlets or for your own functions.
You can create one easily using New-Alias or Set-Alias cmdlets.
To make them available within any Powershell session, put them in the $Profile configuration file.
Let’s have an example :

function start_vm() {
VBoxManage startvm "devbox"
}

Set-Alias -name svm -value start_vm -description "Booting dev VM"

To make these new aliases available in your current session, reload your configuration file :

.$Profile

To list all the available aliases :

Get-Alias

or

gal

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s