...Because someone's gotta tell the story...


To return to the main Blog List, click Full Blog Listing.


Site Updates

PowerShell: Multiple Function Parameters

Saturday, June 22, 2013 in Powershell (Views: 2677)
Just the data, once again. Many examples out there on how to create a simple function, but what about creating a function with more than one parameter?

Well, simple as this:
Function WriteSomething {param([string]$a, [string]$b)
write-host $a $b

Of course, this function, does nothing but write the 2 parameters.

How do you call it? Simple. Now, those used to VBScript are in for a little culture shock, but parameters are separated by spaces, not commas. So, you call it as such:

WriteSomething Hello World

Returns: Hello World


Related Blogs You May Be Interested In:

To leave a comment, please log in and/or register.