LSP это логическая конструкция. Если вы декларируете, что поддерживаете интерфейс X, а при этом поддерживаете только его ограниченное подмножество, то получается неправда.
Создаётся впечатление, что майкрософтовцы, пытаясь дать виндовым сисадминам инструмент «почти как у их никсовых коллег», при решительно отвергли уже готовые идеи и наработки и и сделали всё с нуля, по-своему. NIH во все поля.
Или у меня эффект утёнка после никсов?
Как из этих мелочей это следует? Я так понял, хотели сделать объектныш шелл, интегрированный с их продуктами.
DESCRIPTION
The ForEach-Object cmdlet performs an operation on each item in a collection of input objects. The input objects can be piped to the cmdlet or specified by
using the InputObject parameter.
Beginning in Windows PowerShell 3.0, there are two different ways to construct a ForEach-Object command.
Script block. You can use a script block to specify the operation. Within the script block, use the $_ variable to represent the current object. The script
block is the value of the Process parameter. The script block can contain any Windows PowerShell script.
For example, the following command gets the value of the ProcessName property of each process on the computer.
Get-Process | ForEach-Object {$_.ProcessName}
Operation statement. You can also write a operation statement, which is much more like natural language. You can use the operation statement to specify a
property value or call a method. Operation statements were introduced in Windows PowerShell 3.0.
For example, the following command also gets the value of the ProcessName property of each process on the computer.
Get-Process | ForEach-Object ProcessName
When using the script block format, in addition to using the script block that describes the operations that are performed on each input object, you can
provide two additional script blocks. The Begin script block, which is the value of the Begin parameter, runs before the first input object is processed. The
End script block, which is the value of the End parameter, runs after the last input object is processed.
REMARKS
To see the examples, type: «get-help ForEach-Object -examples».
For more information, type: «get-help ForEach-Object -detailed».
For technical information, type: «get-help ForEach-Object -full».
For online help, type: «get-help ForEach-Object -online»
совершенно не согласласен. Общепринятые сокращения читать удобнее чем не сокращения. Поробуйте, например, заменить все знаки операций на слова в математическом выражении.
«То есть, список я получаю для того, чтобы потом вручную вбивать названия в команду? Тогда это близко по функционалу к командной строке и sc [имя_сервера] start имя_службы [аргументы_службы]»
Ну это и есть командная строка. Только объектная — то есть сгруппировать по статусу вы можете даже если статус изначально не выводится командой gsv и не надо никак описывать формат возврата.
Можно еще результат подать в графический грид и что-то сделать с результатом выбора (параметр -OutputMode у ogv)
Наберите help Where-Object -detailed
Как из этих мелочей это следует? Я так понял, хотели сделать объектныш шелл, интегрированный с их продуктами.
Какие-то мелочи как всегда не доработали.
Какое именно из приведенных сокращений не совпадает с докой или гуглём?
Гугель не нужен — есть же powershell:
NAME
ForEach-Object
SYNOPSIS
Performs an operation against each item in a collection of input objects.
SYNTAX
ForEach-Object [-Process] <ScriptBlock[]> [-Begin ] [-End ] [-InputObject ] [-RemainingScripts <ScriptBlock[]>] [-Confirm]
[-WhatIf] []
ForEach-Object [-MemberName] [-ArgumentList <Object[]>] [-InputObject ] [-Confirm] [-WhatIf] []
DESCRIPTION
The ForEach-Object cmdlet performs an operation on each item in a collection of input objects. The input objects can be piped to the cmdlet or specified by
using the InputObject parameter.
Beginning in Windows PowerShell 3.0, there are two different ways to construct a ForEach-Object command.
Script block. You can use a script block to specify the operation. Within the script block, use the $_ variable to represent the current object. The script
block is the value of the Process parameter. The script block can contain any Windows PowerShell script.
For example, the following command gets the value of the ProcessName property of each process on the computer.
Get-Process | ForEach-Object {$_.ProcessName}
Operation statement. You can also write a operation statement, which is much more like natural language. You can use the operation statement to specify a
property value or call a method. Operation statements were introduced in Windows PowerShell 3.0.
For example, the following command also gets the value of the ProcessName property of each process on the computer.
Get-Process | ForEach-Object ProcessName
When using the script block format, in addition to using the script block that describes the operations that are performed on each input object, you can
provide two additional script blocks. The Begin script block, which is the value of the Begin parameter, runs before the first input object is processed. The
End script block, which is the value of the End parameter, runs after the last input object is processed.
RELATED LINKS
Online Version: go.microsoft.com/fwlink/p/?linkid=289582
REMARKS
To see the examples, type: «get-help ForEach-Object -examples».
For more information, type: «get-help ForEach-Object -detailed».
For technical information, type: «get-help ForEach-Object -full».
For online help, type: «get-help ForEach-Object -online»
2. Можно не ждать, а cinst conemu
То же самое и в случае шелла:
Для опытного человека читабельнее чем
Просто потому, что символ? распознается глазом сразу, и не надо вчитываться select-object там или Select-String
Ну это и есть командная строка. Только объектная — то есть сгруппировать по статусу вы можете даже если статус изначально не выводится командой gsv и не надо никак описывать формат возврата.
Можно еще результат подать в графический грид и что-то сделать с результатом выбора (параметр -OutputMode у ogv)
Процессы можно получить из WMI (см monadblog.blogspot.ie/2006/06/getting-services-associated-with.html)
Что такое в данном случае «переходить к процессам»?
В пош конвеерность объектная