Percent signs (%) and question marks (?) in PowerShell "?"

Source: Internet
Author: User

After studying a problem, we found that PowerShell written on White Paper has the following statements:

$ FarmName = Get-spfarm |%{$ _. Name}

The author's PowerShell is weak and doesn't understand the meaning of the percentage sign. So he asked the expert Tracy Yu to get the following answer:

The percent sign is Alias in PowerShell, meaning ForEach-Object.

 

:

It is not recommended to use Alias when writing PowerShell, which is not easy for others to understand.

 

In addition, Alias can be modified by running the New-Alias command and using Set-Alias.

 

The complete list of all Alias by default is as follows:

CommandType Name Definition
-------------------------
Alias % ForEach-Object
Alias? Where-Object
Alias ac Add-Content
Alias asnp Add-PSSnapIn
Alias cat Get-Content
Alias cd Set-Location
Alias chdir Set-Location
Alias clc Clear-Content
Alias clear-Host
Alias clhy Clear-History
Alias cli Clear-Item
Alias clp Clear-ItemProperty
AliasClsClear-Host
Alias clv Clear-Variable
Alias compare Compare-Object
Alias copy Copy-Item
Alias cp Copy-Item
Alias cpi Copy-Item
Alias cpp Copy-ItemProperty
Alias cvpa Convert-Path
Alias dbp Disable-PSBreakpoint
Alias del Remove-Item
Alias diff Compare-Object
Alias dir Get-ChildItem
Alias ebp Enable-PSBreakpoint
Alias echo Write-Output
Alias epal Export-Alias
Alias epcsv Export-Csv
Alias epsn Export-PSSession
Alias erase Remove-Item
Alias etsn Enter-PSSession
Alias exsn Exit-PSSession
Alias fc Format-Custom
Alias fl Format-List
Alias foreach ForEach-Object
Alias ft Format-Table
Alias fw Format-Wide
Alias gal Get-Alias
Alias gbp Get-PSBreakpoint
Alias gc Get-Content
Alias gci Get-ChildItem
Alias gcm Get-Command
Alias gcs Get-PSCallStack
Alias gdr Get-PSDrive
Alias ghy Get-History
Alias gi Get-Item
Alias gjb Get-Job
Alias gl Get-Location
Alias gm Get-Member
Alias gmo Get-Module
Alias gp Get-ItemProperty
Alias gps Get-Process
Alias group Group-Object
Alias gsn Get-PSSession
Alias gsnp Get-PSSnapIn
Alias gsv Get-Service
Alias gu Get-Unique
Alias gv Get-Variable
Alias gwmi Get-WmiObject
Alias h Get-History
Alias history Get-History
Alias icm Invoke-Command
Alias iex Invoke-Expression
Alias ihy Invoke-History
Alias ii Invoke-Item
Alias ipal Import-Alias
Alias ipcsv Import-Csv
Alias ipmo Import-Module
Alias ipsn Import-PSSession
Alias ise powershell_ise.exe
Alias iwmi Invoke-WMIMethod
Alias kill Stop-Process
Alias lp Out-Printer
Alias ls Get-ChildItem
Alias man help
Alias md mkdir
Alias measure Measure-Object
Alias mi Move-Item
Alias mount New-PSDrive
Alias move Move-Item
Alias mp Move-ItemProperty
Alias mv Move-Item
Alias nal New-Alias
Alias ndr New-PSDrive
Alias ni New-Item
Alias nmo New-Module
Alias nsn New-PSSession
Alias nv New-Variable
Alias ogv Out-GridView
Alias oh Out-Host
Alias popd Pop-Location
Alias ps Get-Process
Alias pushd Push-Location
Alias pwd Get-Location
Alias r Invoke-History
Alias rbp Remove-PSBreakpoint
Alias rcjb Receive-Job
Alias rd Remove-Item
Alias rdr Remove-PSDrive
Alias ren Rename-Item
Alias ri Remove-Item
Alias rjb Remove-Job
Alias rm Remove-Item
Alias rmdir Remove-Item
Alias rmo Remove-Module
Alias rni Rename-Item
Alias rnp Rename-ItemProperty
Alias rp Remove-ItemProperty
Alias rsn Remove-PSSession
Alias rsnp Remove-PSSnapin
Alias rv Remove-Variable
Alias rvpa Resolve-Path
Alias rwmi Remove-WMIObject
Alias sajb Start-Job
Alias sal Set-Alias
Alias saps Start-Process
Alias sasv Start-Service
Alias systolic Data Set-PSBreakpoint
Alias SC Set-Content
Alias select Select-Object
Alias set-Variable
Alias si Set-Item
Alias sl Set-Location
Alias sleep Start-Sleep
Alias sort Sort-Object
Alias sp Set-ItemProperty
Alias spjb Stop-Job
Alias spps Stop-Process
Alias spsv Stop-Service
Alias start Start-Process
Alias sv Set-Variable
Alias swmi Set-WMIInstance
Alias tee-Object
Alias type Get-Content
Alias where Where-Object
Alias wjb Wait-Job
Alias write-Output

 

In addition, the Clear-screen command of PowerShell is Clear-Host and Alias is cls, which is the same as the Dos command.

 

References

==================================

A Cheat Sheet for All the * {_ (% # $] PowerShell Punctuation

Http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/a-cheat-sheet-for-all

An A-Z Index of WindowsPowerShell 2.0Commands

Http://ss64.com/ps/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.