Created
February 7, 2022 12:25
-
-
Save pashalvov/bb025b272ef4d8d19decae718ad0cc0d to your computer and use it in GitHub Desktop.
Тест pipe в функции Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test-PipeInFunction | |
{ | |
[CmdletBinding()] | |
[Alias()] | |
[OutputType([String])] | |
Param | |
( | |
[Parameter(Mandatory=$true, | |
ValueFromPipeline=$true, | |
ValueFromPipelineByPropertyName=$true, | |
ValueFromRemainingArguments=$false, | |
Position=0)] | |
[ValidateNotNull()] | |
[ValidateNotNullOrEmpty()] | |
$Param1 | |
) | |
Begin | |
{ | |
'Call first begin block with Param: ' + $Param1 | |
'Call second begin block with $_: ' + $_ | |
} | |
Process | |
{ | |
'Call process block: ' + $Param1 | |
} | |
End | |
{ | |
'Call end block: ' + $Param1 | |
} | |
} | |
$Array = '1','2','3' | |
$Array | Test-PipeInFunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment