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 Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools