2 PowerShell and CMD and Unix/linux Shell

Source: Internet
Author: User
Tags aliases

The previous article, I said, windows in order to change the user to its console interface, and then start from Windows Vista, plan to change this situation, so there is

The advent of PowerShell.

1. Compatible Shell commands

To be compatible with Unix/linux shell (mainly bash) commands, PowerShell provides a set of mechanisms for compatibility with Cmd.exe and bash commands. This is what was mentioned in the previous article

The alias mechanism. is a compatible cmd command in PowerShell and a command for unix/linux shell.

2. Aliases for standard commands

Similarly, PowerShell provides a set of mechanisms to support command aliases for built-in cmdlets.

We know that Cmdlets uses a consistent user interface pattern: verb-noun. As mentioned above, the above table example aliases are for compatibility with other console interface commands, and the built-in command

Aliases are set up for simplicity. PowerShell provides a set of shorthand names for verbs and nouns based on common commands to name the standard aliases.

For example:

Abbreviations/aliases for verb commands

Get G

Set S

Item I

Location L

Command cm

This way: GI is equivalent to Get-item

Si is equivalent to Set-item

Because these aliases are automatically loaded during PowerShell startup, if you set the command line alias again at the command line, you will be prompted with an error, as shown in:

3. tab Auto-complete function

PowerShell also inherits the TAB key Auto-completion function, but this is not the same as the tab function of CMD and bash, and the tab extension function in PowerShell is implemented by functions.

The function is: tabexpansion control, because you can modify the built-in functions in PowerShell, so you need to be aware.

When typing a command, if you want to use the TAB key to supplement the file name or path, when you type a part of the file name or path, press the TAB key, and the command is automatically replenished in PowerShell as the first

Matches, If you press the TAB key repeatedly, all the available options are displayed individually .

If you are typing a cmdlet, it is different from the supplemental file name and path, and if you want to use the tab extension for the cmdlet name, you need to type the first part of the name and the hyphen that follows it completely. Can be populated

More parts of the name have been matched. For example: Type get-c and then type the TAB key to automatically replenish the Get-childitem command, and if you continue to press the TAB key, the command that is added is get-com

Mand command.

One thing to note when using the command line auto-completion is that whenever the Tan key is interpreted as an auto-replenish command feature, you need to be aware that when copying a command into the shell, the copied content

You cannot include the TAB key later .

2 PowerShell and CMD and Unix/linux Shell

Related Article

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.