Piping in windows powershell

Piping allows you to send the output of one command as an input to another command. For example – Below command will pipe the output of get-help command to “findstr” command.
 
> get-help * | findstr “Cmdlet”

Another example – “Get-Process” command shows the list of all processes on the screen in ascending order. But let us say you want to display the output in descending order. Then you can use piping as shown in below command.
 
> Get-Process | sort – Descending

As you can see in above command, we have used “|” pipe to send the output of “Get-Process” command to Sort command. Another example on piping is given below. Here only top 5 processes will be displayed sorted by Id.
 
> Get-Process | Sort Id | select -First 5

In below example, we are killing all processes with name notepad.
 
> Get-Process -Name notepad | Stop-Process

In below example, we are displaying all methods supported by process object.
 
> Get-Process | Get-Member -MemberType Method

Web development and Automation testing

solutions delivered!!