PowerShell: the mysterious -RemainingScripts parameter of ForEach-Object

前端 未结 5 2104
闹比i
闹比i 2021-02-08 00:21

Short question: anyone has detailed information on -RemainingScripts parameter of ForEach-Object?

Long question:

I just started

5条回答
  •  深忆病人
    2021-02-08 00:56

    Here are it's details. ValueFromRemainingArguments is set to true so your guess is correct.

    help ForEach-Object
    
    -RemainingScripts 
        Takes all script blocks that are not taken by the Process parameter.
    
        This parameter is introduced in Windows PowerShell 3.0.
    

    gcm ForEach-Object | select -exp parametersets 
    
    Parameter Name: RemainingScripts
      ParameterType = System.Management.Automation.ScriptBlock[]
      Position = -2147483648
      IsMandatory = False
      IsDynamic = False
      HelpMessage =
      ValueFromPipeline = False
      ValueFromPipelineByPropertyName = False
      ValueFromRemainingArguments = True
      Aliases = {}
      Attributes =
        System.Management.Automation.ParameterAttribute
        System.Management.Automation.AllowEmptyCollectionAttribute
        System.Management.Automation.AllowNullAttribute
    

提交回复
热议问题