search
Homephp教程PHP开发Example of using Get-Alias ​​command to obtain cmdlet alias in PowerShell

In order to maintain compatibility with the original cmd command in PowerShell, aliases are specially set for many cmdlets. These aliases have the same name as the cmd command, but they represent a cmdlet in PowerShell. For example, the dir cmd command is used to list subfolders and files in a directory. In PowerShell, there is a Get-ChildItem cmdlet, which is also used to list subfolders and files in a directory, so Microsoft Set an alias named dir to Get-ChildItem.

In PowerShell, use the Get-Alias ​​cmdlet to list all aliases and their corresponding cmdlets.

PS C:\Users\zhanghong> Get-Alias
CommandType     Name                            Definition
-----------     ----                            ----------
Alias           %                               ForEach-Object
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
……

The editor has only listed a few of them here. If you are interested, you can check them out one by one.


Have you noticed the following points from the display content given above:

1. The alias can also be a question mark (?), Something like a percent sign (%)
2. A cmdlet can have multiple aliases
3. Some aliases are cmd command names under Windows, and some are Shell command names under Linux (it seems Microsoft is really considerate.)

If anyone wants to ask how to use aliases, well, I almost forgot about this question. Since it is called an alias, it must have replaced the original cmdlet, what do you think?

Regarding the alias of CmdLet in PowerShell, the editor will introduce it like this. I hope it will be helpful to beginners, thank you!

For more related articles on examples of using the Get-Alias ​​command to obtain cmdlet aliases in PowerShell, please pay attention to the PHP Chinese website!


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor