Power and Pith

PowerShell Team

In our newsgroup, Benny asked the question, “How to get subdir items with full path name?”

ClaudioG64 responded:

PS> get-childitem C:\ | foreach-object -process { $_.FullName }

Dreeschkind replied that we had pithier ways of doing it posting:

PS> gci C:\ | % { $_.FullName }

It was at this point that I realized that many of you don’t have a function that many of us in the team use.  So put your seatbelts on and try this one out:

PS> ${function:…} = { process { $_.($args[0]) } }
PS> gci c:\ | … FullName

With Windows PowerShell, you can be Powerful and Pithy!

Enjoy

Jeffrey Snover [MSFT]
Windows PowerShell/MMC Architect
Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

0 comments

Discussion is closed.

Feedback usabilla icon