O'Reilly logo

Microsoft Windows PowerShell 3.0 First Look by Adam Driscoll

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Improvements to Get-ChildItem

Get-ChildItem is a great cmdlet because it traverses multiple providers. For instance, it will work with both the file system and the registry provider. Using it with the file system provider, will return files and directories from the current location as follows:

PS C:\> Get-ChildItem
    Directory: C:\
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----        12/28/2009   9:40 PM            Backup
d----         11/6/2010   1:45 PM            Builds
d----         9/18/2010   9:42 AM            Development

Running the same cmdlet within the context of the registry will have vastly different results as follows:

PS HKLM:\software> Get-ChildItem Hive: HKEY_LOCAL_MACHINE\software Name Property ---- -------- 7-Zip Path : C:\Program Files\7-Zip\ AGEIA Technologies PhysX ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required