This topic contains 4 replies, has 4 voices, and was last updated by Profile photo of Mark Hammonds Mark Hammonds 1 year ago.

  • Author
  • #30105
    Profile photo of Graham Beer
    Graham Beer

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

  • #30106
    Profile photo of Dave Wyatt
    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
    Profile photo of Mark Hammonds
    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
    Profile photo of Rob Simmers
    Rob Simmers

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

  • #30116
    Profile photo of Mark Hammonds
    Mark Hammonds

    LOL that's funny

You must be logged in to reply to this topic.