Ying Li at myITforum.com

PowerShell & System Center

Working with PowerShell Alias

As you guessed, PowerShell has built-in Alias to help you reduce your keystrokes or to “simulate” the command from another scripting language. For example, cd is the PowerShell Alias for set-location and pwd is the Alias for get-location.

Get-Alias (ls Alias: ) will list the aliases for the current session which includes built-in alias, aliases that you have set.

You can create your own alias using new-alias:

Set-Alias help get-help

By default, aliases(you created) are not saved between Windows PowerShell sessions: each time you restart Windows PowerShell you will need to recreate the alias. To permanently save your alias,  create a file named Microsoft.PowerShell_profile.ps1 and add the following line:

Set-Alias help Get-Help

and save it in C:\WINDOWS\system32\windowspowershell\v1.0 folder.

Posted: Jul 02 2007, 02:24 PM by yli628 | with no comments
Filed under:

Comments

No Comments