1-powershell Basic Concepts and usage

Source: Internet
Author: User

Www

What is PowerShell?

PowerShell can be seen as an upgraded version of CMD (Bat scripting language), a scripting language on the Windows platform. She was
Object-oriented. She is closely related to the. Net FrameWork. Can also be thought of as a bash shell on windows

Why would I want to use PowerShell?

  1. Because I'm already learning. Net, Learning PowerShell is easier
  2. CMD is not good enough, PowerShell is more friendly and powerful
  3. Managing apps on Azure is easy

When to use PowerShell

  1. Usually write some small script, for the convenience of operation. such as compiling programs, running gulp,copy delete files and so on.
  2. Operations Windows systems

PowerShell and CMD

In PowerShell, you can continue with the cmd command. PowerShell will load the Cmd.exe when it is initialized

Cmdlets, function, and Scripts1. Concept

The cmdlet is the built-in basic command for PowerShell. Naming is usually a verb + noun. Better remember.

Scripts is the script file that is written.

2. Common Command get-help command

Alias: Help;man;

Usage: Help + command name; (You can use wildcard characters *)

  1. help Get-Command
  2. help Get-Comman*
  3. help *log*#可以使用这种方式来查找命令
  4. help Get-Command-full
  5. help Get-Command-detailed
  6. help Get-Command-examples
  7. #-detailed和-full的区别:
  8. #输出的内容没有区别,但是-full会一次性完全输出。-detailed会根据屏幕的大小输出,然后翻页。

When you use the command Help CD, the following command is output.

  1. Set-Location-LiteralPath<String>[-PassThru][-UseTransaction][<CommonParameters>]
  2. Set-Location[[-Path]<String>][-PassThru][-UseTransaction][<CommonParameters>]
  3. Set-Location[-PassThru][-StackName<String>][-UseTransaction][<CommonParameters>]
  1. It is important to note that these three results are independent of one another. For example: If you use the-path parameter, then if you want to use other parameters, you can only select-passthru;-usetransaction. Like-literalpath and-stackname, they can't be used.
  2. [] This represents a common 8 parameter setting, which is available in each Cmd-let command
  3. Enclosed in brackets, instructions are optional parameters
Get-command

Alias: GCM

Usage: Same as the help command, but only displays information for simple commands

Get-alias alias Command

Alias: Gal

Usage: get-alias-definition command name; get-alias-name alias name

  1. Get-Alias-DefinitionGet-Command#获取Get-Command的别名
  2. Get-Alias-Name ls
  3. #可以使用这种方式来获取命令参数的别名
  4. (get-command get-eventlog |select-ExpandProperty parameters).computername.aliases
Show-command command: Pop up a GUI program to help with the input of the command

Alias: SHCM

Usage: SHCM gal; SHCM Get-help

1-powershell Basic Concepts and usage

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.