Re: Function Args



"ebgreen" <ebgreen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:86B0E7F2-F261-48F0-9979-7E48250FCCA3@xxxxxxxxxxxxxxxx
> This function does not work:
> function doNotShow
> {
> get-process | where{$_.ProcessName -eq $Args[0]}
> }
> If you run it looking for notepad you get nothing back:
> 15:03:56 C:\> doNotShow notepad
> 15:04:01 C:\>

This works:

MSH> function dontShow { $n = $args[0]; "name is $n"; get-process | where {
$_.ProcessName -ne $n}}

I wonder if you have found a bug. I've noticed that processing things like
$args[0] and the value of that is say "foo" can sometimes results in
$args[0] evaluating to "foo[0]".

--
Keith


.