Accessing the Alias Drive in PowerShell

There are many drives and one can find that they can be named after any letter of the alphabet. Drive letters can map to either a physical, logical or network drive. The alias drive is a logical drive that stores aliases. In this tutorial, you will learn how to access the alias drive.

Setup

If you have not already done so, click open Windows PowerShell ISE.

The Concept…

Think of the alias drive as a virtual drive that's used much like a database for PSH. In this particular virtual drive, all your aliases are defined as items, where each item contains a name, as well as a definition. The name is the alias name, and the definition is of course, whatever the alias is meant to represent. PowerShell has a list of predefined aliases, most of which are there to help users like you to continue using familiar DOS-like commands to do traditional command line directory listing. The output however, looks different.

To find out what other aliases are out there, run the following command:

Example

Set-Location alias:
 
Get-ChildItem *
    

Copy and Try it

At the PSH prompt, the drive will show up as Alias:\ instead of your usual drive letter. You will also notice there are numerous of predefined aliases, and if you browse through the alias list, you will notice quite a few familiar DOS and UNIX/LINUX commands in the mix. Both Set-Location and Get-ChildItem have aliases, namely CD and DIR respectively.

That of course, can only mean one thing. That the following command and the one above are EXACTLY the same….

Example

CD alias:
 
DIR *
    

Copy and Try it

And there you have it. Not too difficult right? The New-Item command is a generic command used for creating a new item in a given namespace. So, when you create your alias you specify the path to the alias drive followed by a colon and then the alias name followed by the value for this item.

Remarks last but not least…

Hopefully we made the concept of alias drives and the creation of aliases in the drives more clear than before. Join us next time for additional Windows PowerShell tutorials! Till then…