Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - using named parameters in a SetScriptBlock (typedata)

Reply
 
Old 07-17-2006   #1 (permalink)
/\\/\\o\\/\\/


 
 

using named parameters in a SetScriptBlock (typedata)

can I use named parameters in a SetScriptBlock ?
Param([bool]$value) did not work, but $args -eq $true I don't realy like.

for an example see http://mow001.blogspot.com/2006/07/p...ry-part-4.html

Greetings /\/\o\/\/













































My System SpecsSystem Spec
Old 07-17-2006   #2 (permalink)
Bruce Payette [MSFT]


 
 

Re: using named parameters in a SetScriptBlock (typedata)

No - this is a limitation in V1 - you have to use $args. Now multivalued
assignements can make this fairly painless (and familiar to Perl users :-)

function foo {
param($a, $b, $c)
$a+$b+$c
}

becomes

function foo {
$a, $b, $c = $args
$a+$b+$c
}

-bruce

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



"/\/\o\/\/" <no@spam.mow> wrote in message
news:u5iOQbdqGHA.4508@TK2MSFTNGP04.phx.gbl...
> can I use named parameters in a SetScriptBlock ?
> Param([bool]$value) did not work, but $args -eq $true I don't realy like.
>
> for an example see
> http://mow001.blogspot.com/2006/07/p...ry-part-4.html
>
> Greetings /\/\o\/\/
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Named parameters with Scope PowerShell
Re: re-named folders by WLM Live Mail
Update-TypeData usage PowerShell
Some string typedata extensions PowerShell
Using & operator not possible in typedata.ps1xml ? PowerShell


Vista Forums 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 Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46