Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

variables problems

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 05-03-2007   #1 (permalink)
Nicopilami
Guest


 

variables problems

Hi, i've got a problem with some variable parameters in a function :

function FindUser($parametres,$UserLastName,$UserFirstName)
{
"------------------"
$parametres
$UserFirstName
$UserLastName

Write-Host " -- " $UserLastName
}

if i call : FindUser($args[0],$args[1],$args[2])

, i will obtain the following reult :

3 arguments
------------------
t
nicolas
chaussard
--

so the write-host doesn't return anything... why ??

bye
Nico


My System SpecsSystem Spec
Old 05-03-2007   #2 (permalink)
Nicopilami
Guest


 

Re: variables problems

On 3 mai, 11:10, Nicopilami <n.chauss...@gmail.com> wrote:
> Hi, i've got a problem with some variable parameters in a function :
>
> function FindUser($parametres,$UserLastName,$UserFirstName)
> {
> "------------------"
> $parametres
> $UserFirstName
> $UserLastName
>
> Write-Host " -- " $UserLastName
>
> }
>
> if i call : FindUser($args[0],$args[1],$args[2])
>
> , i will obtain the following reult :
>
> 3 arguments
> ------------------
> t
> nicolas
> chaussard
> --
>
> so the write-host doesn't return anything... why ??
>
> bye
> Nico


i've found the answer on the internet :
the call procedure of a function is not FindUser($args[0],$args[1],
$args[2]) but FindUser $args[0] $args[1] $args[2]
this works fine

Thanks
Nico

My System SpecsSystem Spec
Old 05-03-2007   #3 (permalink)
Keith Hill
Guest


 

Re: variables problems

"Nicopilami" <n.chaussard@gmail.com> wrote in message
news:1178184051.293535.195450@n76g2000hsh.googlegroups.com...
> On 3 mai, 11:10, Nicopilami <n.chauss...@gmail.com> wrote:
> i've found the answer on the internet :
> the call procedure of a function is not FindUser($args[0],$args[1],
> $args[2]) but FindUser $args[0] $args[1] $args[2]
> this works fine


Calling PowerShell functions using a parens enclosed comma separated
parameter list (as opposed to just spaces) is near the top of my PowerShell
gotchas list. :-)

--
Keith

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista environement variables and registry - problems wojtek.ch Vista General 0 01-12-2008 05:49 AM
$Variables Guy Thomas PowerShell 5 06-01-2007 05:05 AM
not using variables IT Staff PowerShell 1 01-09-2007 09:50 PM
Sundeep Raina(Iopsis): Is variables being handled in Workflow and How to declare New Variables sunny Avalon 0 06-30-2006 01:31 AM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008