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 - Seemingly inconsistent behaviour

Reply
 
Old 05-21-2006   #1 (permalink)
Marcel Ortiz


 
 

Re: Seemingly inconsistent behaviour

Please open a bug.

Thanks.
- Marcel

"DBMwS" <DBMwS@discussions.microsoft.com> wrote in message
news:3C3D9D20-9833-4A90-B004-7B4963C3101B@microsoft.com...
> "/\/\o\/\/ [MVP]" wrote:
>
>> MowPS>echo $a |
>> >>

>> but it would be nice if Posh WOULD also recognise a pipeline after a
>> variable

> Anyways, if you assign $a = "a" and then do "MowPS>$a|"(note there is no
> "echo") then it will just display the content of "a" without waiting for
> pipeline to finish if that was what you meant
>
> [^_^]PS[267]>$a = "a"
> [^_^]PS[268]>$a |
> a
> [^_^]PS[269]>
>
>
>> "Andrew Watt [MVP]" wrote:
>> > (get-help get-command) |
>> >
>> > it executes the first step of the pipeline without waiting for further
>> > input.

> BTW, I think even after executing that command if there is a "|", i think
> it
> would make more sense for the pipeline for further input as Andrew has
> pointed out.
> Not only that will make the behavior more consistent, it would be more
> intuitive.




My System SpecsSystem Spec
Old 05-22-2006   #2 (permalink)
Andrew Watt [MVP]


 
 

Seemingly inconsistent behaviour

If I type

get-command |

PowerShell displays the >> cursor and waits for further input.

If I type

(get-help get-command) |

it executes the first step of the pipeline without waiting for further
input.

It seems inconsistent to me. If | is recognised in the first command
as indicating that the command is incomplete why not in the second?

Thanks

Andrew Watt MVP
My System SpecsSystem Spec
Old 05-22-2006   #3 (permalink)
/\/\o\/\/ [MVP]


 
 

RE: Seemingly inconsistent behaviour

in your example I think its the () that will force the Shell to first process
the command inside (making the output look like a variable).

and I think Posh will not recognise a pipeline after a variable,
see this further testing.


MowPS>"a" | write-host -fore 'Yellow'
a
MowPS>"a" |
a
MowPS>echo $a |
>>

MowPS>

but it would be nice if Posh WOULD also recognise a pipeline after a variable.

Greetings /\/\o\/\/

"Andrew Watt [MVP]" wrote:

> If I type
>
> get-command |
>
> PowerShell displays the >> cursor and waits for further input.
>
> If I type
>
> (get-help get-command) |
>
> it executes the first step of the pipeline without waiting for further
> input.
>
> It seems inconsistent to me. If | is recognised in the first command
> as indicating that the command is incomplete why not in the second?
>
> Thanks
>
> Andrew Watt MVP
>

My System SpecsSystem Spec
Old 05-22-2006   #4 (permalink)
DBMwS


 
 

RE: Seemingly inconsistent behaviour

"/\/\o\/\/ [MVP]" wrote:

> MowPS>echo $a |
> >>

> but it would be nice if Posh WOULD also recognise a pipeline after a variable

Anyways, if you assign $a = "a" and then do "MowPS>$a|"(note there is no
"echo") then it will just display the content of "a" without waiting for
pipeline to finish if that was what you meant

[^_^]PS[267]>$a = "a"
[^_^]PS[268]>$a |
a
[^_^]PS[269]>


> "Andrew Watt [MVP]" wrote:
> > (get-help get-command) |
> >
> > it executes the first step of the pipeline without waiting for further
> > input.

BTW, I think even after executing that command if there is a "|", i think it
would make more sense for the pipeline for further input as Andrew has
pointed out.
Not only that will make the behavior more consistent, it would be more
intuitive.
My System SpecsSystem Spec
Old 05-22-2006   #5 (permalink)
Andrew Watt [MVP]


 
 

Re: Seemingly inconsistent behaviour

Done.

https://connect.microsoft.com/feedba...edbackID=78369

Andrew Watt MVP

On Sun, 21 May 2006 13:48:57 -0700, "Marcel Ortiz"
<mosoto@online.microsoft.com> wrote:

>Please open a bug.
>
> Thanks.
>- Marcel
>
>"DBMwS" <DBMwS@discussions.microsoft.com> wrote in message
>news:3C3D9D20-9833-4A90-B004-7B4963C3101B@microsoft.com...
>> "/\/\o\/\/ [MVP]" wrote:
>>
>>> MowPS>echo $a |
>>> >>
>>> but it would be nice if Posh WOULD also recognise a pipeline after a
>>> variable

>> Anyways, if you assign $a = "a" and then do "MowPS>$a|"(note there is no
>> "echo") then it will just display the content of "a" without waiting for
>> pipeline to finish if that was what you meant
>>
>> [^_^]PS[267]>$a = "a"
>> [^_^]PS[268]>$a |
>> a
>> [^_^]PS[269]>
>>
>>
>>> "Andrew Watt [MVP]" wrote:
>>> > (get-help get-command) |
>>> >
>>> > it executes the first step of the pipeline without waiting for further
>>> > input.

>> BTW, I think even after executing that command if there is a "|", i think
>> it
>> would make more sense for the pipeline for further input as Andrew has
>> pointed out.
>> Not only that will make the behavior more consistent, it would be more
>> intuitive.

>

My System SpecsSystem Spec
Old 05-22-2006   #6 (permalink)
Jonathan White [MSFT]


 
 

Re: Seemingly inconsistent behaviour

I filed a bug on this to see what the feature team has to say. Is the
difference in behavior blocking any functionality?

--
Jonathan White [MSFT]
Windows PowerShell Test Team
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.

"/\/\o\/\/ [MVP]" <oMVP@discussions.microsoft.com> wrote in message
news:7D891A97-18A1-4708-BF49-9744398919AE@microsoft.com...
> in your example I think its the () that will force the Shell to first
> process
> the command inside (making the output look like a variable).
>
> and I think Posh will not recognise a pipeline after a variable,
> see this further testing.
>
>
> MowPS>"a" | write-host -fore 'Yellow'
> a
> MowPS>"a" |
> a
> MowPS>echo $a |
>>>

> MowPS>
>
> but it would be nice if Posh WOULD also recognise a pipeline after a
> variable.
>
> Greetings /\/\o\/\/
>
> "Andrew Watt [MVP]" wrote:
>
>> If I type
>>
>> get-command |
>>
>> PowerShell displays the >> cursor and waits for further input.
>>
>> If I type
>>
>> (get-help get-command) |
>>
>> it executes the first step of the pipeline without waiting for further
>> input.
>>
>> It seems inconsistent to me. If | is recognised in the first command
>> as indicating that the command is incomplete why not in the second?
>>
>> Thanks
>>
>> Andrew Watt MVP
>>



My System SpecsSystem Spec
Old 05-22-2006   #7 (permalink)
Andrew Watt [MVP]


 
 

Re: Seemingly inconsistent behaviour

Jonathan,

From my point of view it is highly desirable to have the ability to
type

pipeline step 1 |
>>pipeline step 2 |
>>final step


structure on the command line as it's a great way to teach PowerShell.

The learner can see what each step is and that makes it much easier
for the inexperienced eye to understand what each step is doing and
therefore what the pipeline as a whole is doing.

If the aim of the product team is to spread understanding of
PowerShell as widely as possible (I think that's what their aim ought
to be) then it makes a lot of sense to make it easy for people to get
started and build their understanding of how PowerShell pipelines
work.

Andrew Watt MVP
Author - Professional Windows PowerShell (Wrox)

On Mon, 22 May 2006 11:08:47 -0700, "Jonathan White [MSFT]"
<jwh@zzz.microsoft.com> wrote:

>I filed a bug on this to see what the feature team has to say. Is the
>difference in behavior blocking any functionality?
>
>--
>Jonathan White [MSFT]
>Windows PowerShell Test Team
>Microsoft Corporation
>This posting is provided "AS IS" with no warranties, and confers no rights.
>
>"/\/\o\/\/ [MVP]" <oMVP@discussions.microsoft.com> wrote in message
>news:7D891A97-18A1-4708-BF49-9744398919AE@microsoft.com...
>> in your example I think its the () that will force the Shell to first
>> process
>> the command inside (making the output look like a variable).
>>
>> and I think Posh will not recognise a pipeline after a variable,
>> see this further testing.
>>
>>
>> MowPS>"a" | write-host -fore 'Yellow'
>> a
>> MowPS>"a" |
>> a
>> MowPS>echo $a |
>>>>

>> MowPS>
>>
>> but it would be nice if Posh WOULD also recognise a pipeline after a
>> variable.
>>
>> Greetings /\/\o\/\/
>>
>> "Andrew Watt [MVP]" wrote:
>>
>>> If I type
>>>
>>> get-command |
>>>
>>> PowerShell displays the >> cursor and waits for further input.
>>>
>>> If I type
>>>
>>> (get-help get-command) |
>>>
>>> it executes the first step of the pipeline without waiting for further
>>> input.
>>>
>>> It seems inconsistent to me. If | is recognised in the first command
>>> as indicating that the command is incomplete why not in the second?
>>>
>>> Thanks
>>>
>>> Andrew Watt MVP
>>>

>

My System SpecsSystem Spec
Old 05-22-2006   #8 (permalink)
/\\/\\o\\/\\/


 
 

Re: Seemingly inconsistent behaviour

Jonathan White [MSFT] wrote:
> I filed a bug on this to see what the feature team has to say. Is the
> difference in behavior blocking any functionality?
>


I did not much run in to it,
but I'm used to do a layout like this in scripts
and like to past them in to the commandline

(get-help get-command).syntax |
foreach-object {
write-host -fore 'yellow' "Syntax : "
$_ | ft
$_ | fl
$_
}

and | I consider a good point for breaking the line for readability.

gr /\/\o\/\/
My System SpecsSystem Spec
Old 05-23-2006   #9 (permalink)
Oisin G.


 
 

Re: Seemingly inconsistent behaviour

I agree wholeheartedly.

(my two cents)

- Oisin

"Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message
news:j32472tbuoj2pk6dtotocgpfml71e0p1lj@4ax.com...
> Jonathan,
>
> From my point of view it is highly desirable to have the ability to
> type
>
> pipeline step 1 |
>>>pipeline step 2 |
>>>final step

>
> structure on the command line as it's a great way to teach PowerShell.
>
> The learner can see what each step is and that makes it much easier
> for the inexperienced eye to understand what each step is doing and
> therefore what the pipeline as a whole is doing.
>
> If the aim of the product team is to spread understanding of
> PowerShell as widely as possible (I think that's what their aim ought
> to be) then it makes a lot of sense to make it easy for people to get
> started and build their understanding of how PowerShell pipelines
> work.
>
> Andrew Watt MVP
> Author - Professional Windows PowerShell (Wrox)
>
> On Mon, 22 May 2006 11:08:47 -0700, "Jonathan White [MSFT]"
> <jwh@zzz.microsoft.com> wrote:
>
>>I filed a bug on this to see what the feature team has to say. Is the
>>difference in behavior blocking any functionality?
>>
>>--
>>Jonathan White [MSFT]
>>Windows PowerShell Test Team
>>Microsoft Corporation
>>This posting is provided "AS IS" with no warranties, and confers no
>>rights.
>>
>>"/\/\o\/\/ [MVP]" <oMVP@discussions.microsoft.com> wrote in message
>>news:7D891A97-18A1-4708-BF49-9744398919AE@microsoft.com...
>>> in your example I think its the () that will force the Shell to first
>>> process
>>> the command inside (making the output look like a variable).
>>>
>>> and I think Posh will not recognise a pipeline after a variable,
>>> see this further testing.
>>>
>>>
>>> MowPS>"a" | write-host -fore 'Yellow'
>>> a
>>> MowPS>"a" |
>>> a
>>> MowPS>echo $a |
>>>>>
>>> MowPS>
>>>
>>> but it would be nice if Posh WOULD also recognise a pipeline after a
>>> variable.
>>>
>>> Greetings /\/\o\/\/
>>>
>>> "Andrew Watt [MVP]" wrote:
>>>
>>>> If I type
>>>>
>>>> get-command |
>>>>
>>>> PowerShell displays the >> cursor and waits for further input.
>>>>
>>>> If I type
>>>>
>>>> (get-help get-command) |
>>>>
>>>> it executes the first step of the pipeline without waiting for further
>>>> input.
>>>>
>>>> It seems inconsistent to me. If | is recognised in the first command
>>>> as indicating that the command is incomplete why not in the second?
>>>>
>>>> Thanks
>>>>
>>>> Andrew Watt MVP
>>>>

>>



My System SpecsSystem Spec
Old 05-31-2006   #10 (permalink)
Bruce Payette [MSFT]


 
 

Re: Seemingly inconsistent behaviour

Just to follow up on this issue - it is a known problem. It happens when the
first element of a pipeline is an expression e.g. a variable, a property
reference or something in brackets and it's only a issue in interactive
mode. So

PS (7) > get-date |
>> write-output
>>


prompts because get-date is a cmdlet, not an expression

PS (8) > (get-date) |

doesn't prompt because (get-date) is recognized as an expression. Likewise,
the expressions

PS (9) > $a=3 ; $a |
3
PS (10) > 2 + 2 |
4

also don't prompt. In scripts however, everything works fine:

PS (13) > invoke-expression @'
>> 2+2 |
>> %{ "+++ $_" }
>> '@
>>

+++ 4
PS (14) >

It's a bug in the way the interpreter decides when it needs more text in
interactive mode.

-bruce

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



"Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message
news:vev372psj2dbt3hqauivlsijubboo1qm9k@4ax.com...
> Done.
>
> https://connect.microsoft.com/feedba...edbackID=78369
>
> Andrew Watt MVP
>
> On Sun, 21 May 2006 13:48:57 -0700, "Marcel Ortiz"
> <mosoto@online.microsoft.com> wrote:
>
>>Please open a bug.
>>
>> Thanks.
>>- Marcel
>>
>>"DBMwS" <DBMwS@discussions.microsoft.com> wrote in message
>>news:3C3D9D20-9833-4A90-B004-7B4963C3101B@microsoft.com...
>>> "/\/\o\/\/ [MVP]" wrote:
>>>
>>>> MowPS>echo $a |
>>>> >>
>>>> but it would be nice if Posh WOULD also recognise a pipeline after a
>>>> variable
>>> Anyways, if you assign $a = "a" and then do "MowPS>$a|"(note there is no
>>> "echo") then it will just display the content of "a" without waiting for
>>> pipeline to finish if that was what you meant
>>>
>>> [^_^]PS[267]>$a = "a"
>>> [^_^]PS[268]>$a |
>>> a
>>> [^_^]PS[269]>
>>>
>>>
>>>> "Andrew Watt [MVP]" wrote:
>>>> > (get-help get-command) |
>>>> >
>>>> > it executes the first step of the pipeline without waiting for
>>>> > further
>>>> > input.
>>> BTW, I think even after executing that command if there is a "|", i
>>> think
>>> it
>>> would make more sense for the pipeline for further input as Andrew has
>>> pointed out.
>>> Not only that will make the behavior more consistent, it would be more
>>> intuitive.

>>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Inconsistent window behaviour Live Mail
WLM 9 Beta: Inconsistent Behaviour in number of contacts in catego Live Messenger
Access 2003 database inconsistent behaviour between Vista and XP Vista General
Inconsistent Usenet quoting behaviour Vista mail
Inconsistent behaviour when using set-location with different providers 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