• 3. Built-In Powershell Aliases

    Posted on February 22, 2013 by in Desktop Engineering, Powershell, Scripting

    In PowerShell, an alias is another name assigned to a cmdlet, function, script, executable file, and so on. Just about anything you can run from the PowerShell command prompt can have an alias assigned to it.Windows users can utilize commands like dir, move, type, cls, etc… PowerShell also provides a set of aliases for Linux; ls, pwd, mv, man, cat, etc… PowerShell Aliases are provided for the purpose of allowing new users the ability to quickly interact with the shell. An alias is an alternative name assigned to a cmdlet. For example, “dir” is an alias for “Get-ChildItem.” This tutorial presents two types of aliases:

    Built-in Aliases – Predefined alternative names for Windows, Unix, and PowerShell cmdlets.
    User-defined Aliases – Custom alternative names created by the user.

    Built-In PowerShell Aliases
    Built-in aliases are predefined. Use the following cmdlet to get a list of PowerShell Aliases:

     Get-Alias <enter> 


     
    While going through the list, you will find that there are multiple Aliases for the “Get-ChildItem” cmdlet. Windows “dir” command, Unix “ls” command, and a PowerShell alias “gci” command. No matter which alias you have chosen to use, typing any one of the aliases will result in the running of the “Get-ChildItem” cmdlet.

     type the following:
    dir <enter>
    ls <enter>
    gci <enter>
    Get-ChildItem <enter> 

    You can verify that each command resulted in the same output. In reality, we just ran “Get-ChildItem” four times. There is really not much more to built-in aliases.
    In the next session User-Defined aliases will be disucussed in detail.

     
     
    Be Sociable, Share!

    Written by

    Senior Desktop/Infrastructure Engineer with over 10 years of proven experience in planning,designing & implementation of enterprise level Workstation builds for Finance, Pharmaceuticals, Telecommunication and other Domains. Desktop Engineer cannot rest as, Desktop world is very different it is fast paced, new technologies evolve and change at a rapid pace. For more info please visit: www.linkedin.com/in/srinivaskolla

    View all articles by

    Email : [email protected]

    Leave a Reply