Windows Vista Forums

How many parameters ($args) can be passed to a function?

  1. #1


    Kryten Guest

    How many parameters ($args) can be passed to a function?

    Hi,
    Does anyone know how many parameters or arguments I can pass to a
    function?

    Thanks,
    K




      My System SpecsSystem Spec

  2. #2


    Alexander Vasilevsky Guest

    Re: How many parameters ($args) can be passed to a function?

    no restriction

    --
    http://www.alvas.net - Audio tools for C# and VB.Net developers


    "Kryten" <Kryten68@xxxxxx> ???????/???????? ? ???????? ?????????:
    news:1194302311.448061.81120@xxxxxx

    > Hi,
    > Does anyone know how many parameters or arguments I can pass to a
    > function?
    >
    > Thanks,
    > K
    >


      My System SpecsSystem Spec

  3. #3


    Kryten Guest

    Re: How many parameters ($args) can be passed to a function?

    On 5 Nov, 22:54, "Alexander Vasilevsky" <al...@xxxxxx> wrote:

    > no restriction
    :-))))
    Thank You!
    K



      My System SpecsSystem Spec

  4. #4


    Jon Guest

    Re: How many parameters ($args) can be passed to a function?


    "Kryten" <Kryten68@xxxxxx> wrote in message
    news:1194302311.448061.81120@xxxxxx

    > Hi,
    > Does anyone know how many parameters or arguments I can pass to a
    > function?
    >
    > Thanks,
    > K
    >


    Just tried 10000 arguments here, which worked fine
    (got bored waiting for 100000 to finish , sorry ;-) ....


    function HowManyArgs {

    $i=0
    ForEach ($k in $Args) {$i=$i+1}
    $i

    }

    $expr = "HowManyArgs "
    foreach ($m in 1..10000) {$expr = $expr + ($m.ToString()) + ' '}
    invoke-expression $expr

    --
    Jon



      My System SpecsSystem Spec

  5. #5


    Shay Levi Guest

    Re: How many parameters ($args) can be passed to a function?

    $args is an array object, I don't think there's a limit unless there's a
    limit to the array object.

    -----
    Shay Levi
    $cript Fanatic
    http://scriptolog.blogspot.com



    > Hi,
    > Does anyone know how many parameters or arguments I can pass to a
    > function?
    > Thanks,
    > K


      My System SpecsSystem Spec

  6. #6


    Keith Hill [MVP] Guest

    Re: How many parameters ($args) can be passed to a function?

    "Shay Levi" <no@xxxxxx> wrote in message
    news:8766a944c6e58c9ee2be925e1e6@xxxxxx

    > $args is an array object, I don't think there's a limit unless there's a
    > limit to the array object.
    >
    Well the max index is 2GB - 1. But even with 10000 args tested (and
    verified), I'd say there is no "practical" limit. :-)

    --
    Keith


      My System SpecsSystem Spec

  7. #7


    Shay Levi Guest

    Re: How many parameters ($args) can be passed to a function?


    Thanks for the info.

    -----
    Shay Levi
    $cript Fanatic
    http://scriptolog.blogspot.com



    > "Shay Levi" <no@xxxxxx> wrote in message
    > news:8766a944c6e58c9ee2be925e1e6@xxxxxx
    >

    >> $args is an array object, I don't think there's a limit unless
    >> there's a limit to the array object.
    >>
    > Well the max index is 2GB - 1. But even with 10000 args tested (and
    > verified), I'd say there is no "practical" limit. :-)
    >
    > --
    > Keith


      My System SpecsSystem Spec

  8. #8


    Bruce Payette [MSFT] Guest

    Re: How many parameters ($args) can be passed to a function?

    Correct. The only limits are [int32]::MaxValue and the amount of memory you
    have on your system.

    -bruce

    --
    Bruce Payette [MSFT]
    Principal Developer, Windows PowerShell
    Microsoft Corporation
    This posting is provided "AS IS" with no warranties, and confers no rights.

    Visit the Windows PowerShell Team blog at:
    http://blogs.msdn.com/PowerShell
    Visit the Windows PowerShell ScriptCenter at:
    http://www.microsoft.com/technet/scr.../hubs/msh.mspx
    My Book: http://manning.com/powershell

    "Keith Hill [MVP]" <r_keith_hill@xxxxxx_no_spam_I> wrote in message
    news:570383FA-667C-4227-85CE-C5692EE3ED00@xxxxxx

    > "Shay Levi" <no@xxxxxx> wrote in message
    > news:8766a944c6e58c9ee2be925e1e6@xxxxxx

    >> $args is an array object, I don't think there's a limit unless there's a
    >> limit to the array object.
    >>
    >
    > Well the max index is 2GB - 1. But even with 10000 args tested (and
    > verified), I'd say there is no "practical" limit. :-)
    >
    > --
    > Keith


      My System SpecsSystem Spec

How many parameters ($args) can be passed to a function?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Function parameters question Philip Colmer PowerShell 3 11 Aug 2008
XML node passed to function David Trimboli PowerShell 4 15 Jul 2008
Howto: pass all args to a sub function? Staffan Gustafsson PowerShell 3 23 May 2007
Defining function parameters Ted Brewster PowerShell 1 13 Dec 2006
How To: Use Parameters sent to a function regardless of order Brandon Shell PowerShell 3 24 Aug 2006