tags:

views:

215

answers:

2

Simple (probably stupid) question. I'm a Powershell novice and am mainly using it to instantiate managed libraries so I don't have to write little apps when I need to use members from them. Some of these libraries are old and have methods with long, painful signatures. Using get-member after instantiating with new-object, I've often run into frustrating results like this:

PS> $object | get-member MethodWithLongSignature

TypeName: SomeLib.SomeObject

Name                      MemberType Definition
----                      ---------- ----------
MethodWithLongSignature   Method     System.Void MethodWithLongSignature(string param1, int param2, string param3, string param4, stri....

Is there any way to wrap the results of get-member? Alternatively, is there a switch for get-member that will produce the results in a manner that won't wrap?

+3  A: 

Output in table structures are auto-formatted to fit the width of the screen, truncating long values in the process if necessary.

Pipe the results into the format-list command to get verbose, vertical formatting of the results.

PS> $object | get-member MethodWithLongSignature | format-list
HipCzeck
That's the one. Thanks!
AJ
A: 

Format-Table has a -Wrap switch to wrap the last column. Since the last column of the output of Get-Member is pretty big already, this will produce readable results.

Another option is Format-Wide (but it doesn't wrap, so you are limited to console width):

Get-Process | Get-Member | Format-Wide Definition -Column 1
JasonMArcher