In PowerShell, in order to be compatible with the original cmd command, aliases are specifically set for many cmdlet. These aliases have the same name as the cmd command, but they represent a cmdlet in a PowerShell. Like dir, this cmd command, which lists subfolders and files in a directory, has a Get-childitem cmdlet in PowerShell, and it also lists subfolders and files in a directory. So Microsoft gave Get-childitem a name called Dir.
In PowerShell, using the Get-alias cmdlet, you can list all aliases and their corresponding cmdlet.
Copy Code code as follows:
PS c:\users\zhanghong> Get-alias
CommandType Name Definition
----------- ---- ----------
Alias% Foreach-object
The Alias? Where-object
Alias Cat Get-content
Alias CD Set-location
Alias chdir set-location
Alias Clear Clear-host
Alias Clhy Clear-history
Alias CLS Clear-host
Alias CLV clear-variable
Alias Compare Compare-object
Alias Copy Copy-item
Alias CP Copy-item
Alias CPI Copy-item
......
Small series here only listed a very small part of everyone interested can go to see.
Have you seen from the above show that this is a few things:
1, the alias can also be a question mark (?), percent semicolon (%) such dongdong
2. A cmdlet can have multiple aliases
3, some aliases are windows under the CMD command name, and some are under the Linux shell command name (it seems Microsoft is really very thoughtful ha)
If someone wants to know how to use the alias, well, I almost forgot the question. Since it's called an alias, it must have replaced the original cmdlet, don't you think?
About the PowerShell of the cmdlet in the alias, small series on the introduction so, hope to beginners have a certain help, thank you!