Re: Function Args
- From: "Keith Hill [MVP]" <r_keith_hill@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 18 Jan 2006 16:01:49 -0700
"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
.
- Prev by Date: Re: remove elemento from array
- Next by Date: Re: Function Args
- Previous by thread: RE: Auto shutdown of workstations
- Next by thread: Re: Function Args
- Index(es):