OmniSecu.com Logo  
omnisecu.com free mcse ccna rhce linux java learning
omnisecu.com free mcse ccna rhce linux java learning
          Sharefacebook twitter google+ google bookmark yahoo bookmark delicious digg linkedin pinterest reddit stumbleupon evernote diigo blinklist blogmarks livejournal email feed

Tutorials

How to create or remove aliases in PowerShell

External Resources

As we discussed in the previous lesson, PowerShell PowerShell aliases allows to create the commands which we are familiar in other shells like Windows Command Prompt or Unix shells from PowerShell cmdlets.

Some examples of built-in aliases are

• "gal" is the alias for Get-Alias cmdlet.

• "cd" is the alias for Set-Location cmdlet.

• "dir" is the alias for Get-ChildItem cmdlet.

• "ls" is another alias for Get-ChildItem cmdlet, for those who are accustomed with Unix shells.

To view all built-In PowerShell Aliases use the command Get-Alias.

To set an alias, use the command Set-Alias. Example, if you want to create a new alias "listdirectory" to list the contents of a directory, you can use the following command.

PS C:\> Set-Alias listdirectory Get-ChildItem

The screenshot of the Set-Alias command inside PowerShell window is shown below.

PowerShell Set-Alias cmdlet

To list the contents of a directory use the new alias "listdirectory", in PowerShell. The output of the "listdirectory" alias is shown below.

PowerShell using new alias

To remove an alias, use the cmdlet Remove-Item as shown below.

PS C:\> Remove-Item alias:\listdirectory

              Jajish Thomason Google+
Related Topics

No Related Topics Available

comments powered by Disqus


eXTReMe Tracker DMCA.com