ForEach

De Linuxmemo.

(Différences entre les versions)
Linuxmemo (discuter | contributions)
(Page créée avec « Catégorie:PowerShell ==Commande== ==Methode== ForEach and Where methods Both the ForEach and Where intrinsic methods for arrays take a scriptblock as an input paramete... »)
Modification suivante →

Version du 14 décembre 2022 à 11:01

Commande

Methode

ForEach and Where methods

Both the ForEach and Where intrinsic methods for arrays take a scriptblock as an input parameter.

You can use the $PSItem in those scriptblocks to access the current object ("$PSItem" = "$_").

@('a', 'b', 'c').ForEach({ $PSItem.ToUpper() }).Where({ $PSItem -ceq 'B' })
Outils personnels