Piping to a script block

Welcome Forums General PowerShell Q&A Piping to a script block

This topic contains 2 replies, has 2 voices, and was last updated by

2 years, 8 months ago.

  • Author
  • #47399

    Points: 34
    Rank: Member

    This code works but I don't understand why.

    Is this dot sourcing a script block or something else?

  • #47401

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Yeah, it's essentially dot-sourcing a script block. Kinda. $_ represents the pipeline object being input to the script. Visually, I find it a poor practice – it isn't appreciably different from using ForEach-Object, and it's not as easy to understand.

  • #47481

    Points: 34
    Rank: Member

    Yep. Confused me.


The topic ‘Piping to a script block’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort