DCSIMG
PowerShell CTP3 quick tip - Shay Levy

Shay Levy

If you repeat it, PowerShell it!

PowerShell CTP3 quick tip

In previous versions of PowerShell if you wanted to discover the static members of a type you had to do:


PS > [IO.File] | Get-Member –Static

TypeName: System.IO.File Name MemberType ---- ---------- AppendAllText Method AppendText Method Copy Method Create Method CreateText Method (...)


In CTP3 there’s no need to do that anymore, start with:

PS > [IO.File]::

Now press the TAB key and watch the magic (keep hitting TAB to cycle through all members).

Comments

Jason Archer said:

And those of us with PowerTab have had this for a while.  ;)

# January 29, 2009 7:18 PM

ScriptFanatic said:

Thanks to Power MoW!

# January 29, 2009 8:50 PM

tojo2000 said:

Excellent.  I like PowerTab, but I use a lot of systems that don't have it installed.

It's the little things like this that make my geeky heart go pitter-patter.

# January 31, 2009 3:26 AM

Aleksandar said:

In the latest version of PowerShell Plus (2.1 beta) it's not necessary to hit TAB key and a pop-up menu will show up with all static members, syntax and links to MSDN page and Google (populated with proper keywords). That's a real time-saver.

# February 7, 2009 1:00 PM

Thomas Lee said:

Thanks for the tip.

However, you are comparing two slightly different things.

[IO.File] | Get-Member –Static produces a list of , in this case, static methods with at least part of a definition.

[IO.File]::<tab> produces a one at a time enumeration on the screen without the definition.

It's COOL that we have better tab support, but the two methods do do slightly different things.

Thomas

# February 7, 2009 8:56 PM

Episode 58 - PowerShell ISE panel « PowerScripting Podcast said:

Pingback from  Episode 58 - PowerShell ISE panel &laquo; PowerScripting Podcast

# February 9, 2009 6:05 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: