Почему вы не можете транслировать из любых операторов powershell, таких как foreach и while («пустой элемент pipe не разрешен»)?Есть ли какие-то технические ограничения?
PS /Users/me> foreach ($i in 1,2,3) { $i } | measure
At line:1 char:30
+ foreach ($i in 1,2,3) { $i } | measure
+ ~
An empty pipe element is not allowed.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EmptyPipeElement
PS /Users/me> for ($i = 1;$i -lt 10; $i++) { $i } | measure
At line:1 char:37
+ for ($i = 1;$i -lt 10; $i++) { $i } | measure
+ ~
An empty pipe element is not allowed.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EmptyPipeElement
PS /Users/me> $i = 1
PS /Users/me> while ($i -lt 10 ) { $i;$i++ } | measure
At line:1 char:32
+ while ($i -lt 10 ) { $i;$i++ } | measure
+ ~
An empty pipe element is not allowed.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EmptyPipeElement
Список операторов powershell:
if .. else
Switch
Do .. while
ForEach
Для
Пока
Перерыв
Продолжить