Results 1 to 5 of 5

Thread: Calling a function with arguments or parameter in Powershell?

  1. #1
    Join Date
    Jan 2009
    Posts
    36

    Calling a function with arguments or parameter in Powershell?

    Hi,

    I don't understand the difference between the parameter & arguments in the powershell while calling a function?

    Can you guys please help me understanding the basic difference & the advantages or disadvantages?

  2. #2
    Join Date
    Jan 2009
    Posts
    19

    Re: Calling a function with arguments or parameter in Powershell?

    Well I don't think there is much difference between the two methods of calling a function! But its your personal liking about your style!

    You can call function both ways!

    Hope this helps!

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: Calling a function with arguments or parameter in Powershell?

    Dealing with Parameters in Powershell

    This is a link where you understand function with parameters!

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: Calling a function with arguments or parameter in Powershell?

    PowerShell is a bit funky.. When you create a function and you want to supply parameters, the following format applies:

    function fname {

    param([string]$a, [int]$b) # the two parameters.

    write-host ("a = " + $a)

    write-host ("b = " + $b)

    }

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Calling a function with arguments or parameter in Powershell?

    This is what I think you will find it more helpful!

    http://powershelllive.com/blogs/lunc...-vbscript.aspx
    and
    http://poshoholic.com/2007/10/06/pow...ion-or-script/

    Hope this helps!

Similar Threads

  1. Parameter function and generic pointer
    By Rubero in forum Software Development
    Replies: 7
    Last Post: 25-09-2010, 09:04 PM
  2. Pointer parameter in a function
    By Chrisch in forum Software Development
    Replies: 4
    Last Post: 14-12-2009, 10:57 PM
  3. Passing arguments to a function
    By Aman 1 in forum Software Development
    Replies: 3
    Last Post: 09-12-2009, 01:11 PM
  4. Matrix parameter function
    By Chrisch in forum Software Development
    Replies: 3
    Last Post: 02-12-2009, 11:07 AM
  5. Function with a variable number of arguments
    By Chrisch in forum Software Development
    Replies: 3
    Last Post: 20-11-2009, 02:03 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,247,033.37894 seconds with 16 queries