Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Function in a script

$
0
0

hi all,

I'm currently learning PowerShell and loving it. but I ran into a brick wall and I have no idea why my script behaves like this.

to learn how to insert a function into a script, I built this simple one;

Function test ($Name, $Value) {

   write-host "The name is $Name and the value is $Value"

}

test ALLUSERS, 1

when I try my script, I thought I'd see "The name is ALLUSERS and the value is 1"

but guess what? the script writes "The name is ALLUSERS 1 and the value is "

what am I doing wrong? why is both parameters together like this instead of the positions I wish for them to be?

thank you!


Viewing all articles
Browse latest Browse all 6937

Trending Articles