PowerShell Usage Tutorials

Source: Internet
Author: User

I. Description 1.1 Background Notes

The individual is not very familiar with PowerShell, and at the beginning it suddenly saw a new folder called PowerShell in the Start menu, and later saw a tutorial video saying that PowerShell was great but didn't listen much, And then I saw that Kali had a few PowerShell scripts to realize that PowerShell should be really unique and getting recognized. But my use of PowerShell was a long time ago when I saw an article on the Internet that PowerShell can count, so it's often used as a calculator. It was not until yesterday that I saw the Windows PowerShell real-combat guide that I had a more complete understanding.

What is 1.2 powershell?

Many people come up on what is based on. NET strong invincible, first as a user I do not care about what technology you are, I first want to know is what you provide is what, how to use.

PowerShell, from the name can be known, he first is a shell,shell meaning is the same as the Linux bash, and the same as the original CMD is inside the command (executable file) to use;

And power means that he is a powerful shell, from the user-oriented, the personal feel that its powerful embodiment in the following aspects:

(1) Microsoft attitude. Microsoft is really in the implementation of PowerShell, including office and more home software, the bottom is called PowerShell to achieve.

(2) Compatibility cmd. PowerShell contains all the commands of the original CMD, the original command used in the same form, and the command is added on its basis.

(3) to superscript Linux. PowerShell uses the idea of a Linux shell, that is, all system operations, configurations, can be written in the shell command implementation.

(4) Unified command format and self-contained documentation. Based on the first 3 points we can say that PowerShell has been available with Linux bash and so on, if coupled with the advantage of the latter, it can make people believe that PowerShell can be successful. What do you think is the biggest disadvantage of a shell like bash? From my point of view, I think the cost is very high, the beginning is I do not know what command to use what the command I need to Baidu, second, I often forget the command parameter format how to write in the good and bad online Baidu half-day (man handbook? I am sorry I often do not understand, my blog before writing a lot about the shell command of the article is the memo, so many articles on the web about the shell command is not because I am particularly stupid. And that's two advantages of PowerShell: The 1th is PowerShell all commands using a Unified cmdlet command format (that is, the "verb-noun" format, such as Get-process), makes it easy to remember 2nd here, the so-called self-contained means you have to do one thing you can gradually find all the commands you need to do, even if you can't remember the commands you can easily find, you find the command to read the document is easy to know how to use.

Below the second large sections, we will assume that we know nothing about PowerShell, and take a look at what is called PowerShell's "unified command format and self-contained documentation" by killing the process of a notepad process. I do not introduce a bunch of commands here, but instead introduce the idea of using PowerShell, and other work can be done with similar ideas.

Second, PowerShell uses 2.1 to start PowerShell

(1) Execute PowerShell directly in CMD and switch to PowerShell

(2) Enter PowerShell from the Start menu to start PowerShell

(3) Start menu----Attachment----PowerShell launcher

With x86 is 32 bits, not with 64 bits; with IES is a simple IDE

2.2 Using PowerShell

After the PowerShell boot interface is as follows

2.1.1 Get-help View Help

We don't know anything about it, so let's enter help and try it, okay, PowerShell does support

(but we said earlier that the PowerShell command is a cmdlet format, and Help uses the cmdlet format, Help is just an alias for Get-help)

2.2.2 Get-command See what the commands are

After determining that PowerShell supports GET-HELP, we first need to know which commands PowerShell supports, and in get-help you can see the commands that you can use to view PowerShell support in Get-command

CommandType columns, which represent command types, alias aliases, cmdlets are PowerShell-formatted commands, function is functions

Name column, which is the command

Definition column, simple description of command function

2.2.3 Get-command Narrow Range

The above command is too much, we need to narrow down to determine what the PS-like command is in PowerShell (of course we said PowerShell-compatible CMD so you can use PS directly, but this is not what we want here)

The view information is get-beginning, so we guess the command to view the process also starts with get-, executes Get-command get-* try

As shown in the results, it is good to have no more than one layout for all commands, where we see a command called Get-process, a look at the process information

2.2.4 Get-process Lookup Process

We locked the order in get-process. But we don't know how to use this command, 2.2.1 said you can see the help in the form of get-help command, and we'll try

You can see that all the options are in brackets, so execute get-process directly.

However, it is possible to guess that no filter returns the list of all processes that need to be filtered, you can see the-name parameter can filter the process name, for the sake of insurance we also add the * number wildcard character

The whole command to be executed is: Get-process-name *notepad*

2.2.5 stop-process Kill Process

The first idea is that there are stop-process in the relevant link in Get-help get-process, which is the command to kill the process

The second idea is: The acquisition process is get-process, then the kill process is also a large probability is xxx-process

Execution: Get-command *process

You can see just 5 commands, and only stop-process compare like, use Get-help to see Help by the way to confirm is not

Obviously, and the KILL command is: Stop-process-id PID

PowerShell Usage Tutorial

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.