Datasheet

20 CHAPTER 1
WINDOWS POWERSHELL 101
CMDLET ALIASES
There are some cmdlets within Windows PowerShell that have built-in abbreviations
known as an alias. For example, rather than typing
Get-Command
, you could simply
type
gcm
, and similarly for
Get-Member
, you can type
gm
. There are numerous built-
in aliases, and you can see them all by executing the Get-Alias cmdlet as shown. The
following results have been trimmed to show the most common aliases:
PS C:\> Get-Alias
CommandType Name Definition
----------- ---- ----------
Alias % ForEach-Object
Alias ? Where-Object
Alias asnp Add-PSSnapIn
Alias cat Get-Content
Alias cd Set-Location
Alias chdir Set-Location
Alias cls Clear-Host
Alias copy Copy-Item
Alias del Remove-Item
Alias diff Compare-Object
Alias dir Get-ChildItem
Alias echo Write-Output
Alias fc Format-Custom
Alias fl Format-List
Alias foreach ForEach-Object
Alias ft Format-Table
Alias fw Format-Wide
Alias gm Get-Member
Alias ise powershell_ise.exe
Alias ogv Out-GridView
Alias select Select-Object
Alias set Set-Variable
Alias sleep Start-Sleep
Alias sort Sort-Object
Alias start Start-Process
Alias tee Tee-Object
Alias where Where-Object
Alias write Write-Output
Several of these aliases will be used throughout the course of the book.
You can also create new aliases using the
Set-Alias
cmdlet. Type
help about_
aliases
for more information about using and creating aliases.
c01.indd 20c01.indd 20 5/16/2011 11:12:32 AM5/16/2011 11:12:32 AM