This topic contains 4 replies, has 4 voices, and was last updated by  Mark Hammonds 2 years, 8 months ago.

  • Author
  • #30105

    Graham Beer

    Can someone help explain on how @args works ? Do i pass objects to it ? Any examples would be great, thanks.

  • #30106

    Dave Wyatt

    $args is an automatic variable which contains all of the unbound arguments passed to a non-advanced function. For example:

    function Test-Args
    Test-Args 1 2 3 4 5

    When you use @args, you're splatting this array to some other command. See the about_Splatting help file for more details on that.

  • #30109

    Mark Hammonds

    Sweet Jesus and all this time I thought it had something to do with Pirates.... I love this site 4 weeks ago I did not know any PowerShell now after reading 4 books and 3 MVA courses im so addicted to it I find my self trying to apply it to everything. I have already applied what I have learned to several real world issues within my IT environment. The local desktop guys love the scripts I give them.

  • #30115

    Rob Simmers

    You're mixing up @args with @arrr. The latter being the splatting of pirates foes.... 🙂

  • #30116

    Mark Hammonds

    LOL that's funny

You must be logged in to reply to this topic.