Monthly Archive

Categories

Paths III

Resolve-Path is interesting in that

Resolve-Path c:\scripts\*

"c:\scripts\*" | Resolve-Path

both supply a listing of the contents of the folders.  A sample is shown

C:\scripts\WMICookBook
C:\scripts\WPF
C:\scripts\XML
C:\scripts\auto.csv
C:\scripts\computers.txt
C:\scripts\emptyfolders.txt
C:\scripts\encrypted.txt
C:\scripts\firewall.ps1
C:\scripts\import-mymodule.ps1

 

It shows files and subfolders with no way to distinguish. There isn’t a way to recurse through sub folders

A System.Management.Automation.PathInfo object is returned with these properties

Drive
Path
Provider
ProviderPath

default is just to display the path.

I’m not 100% sure what I’ll be using this cmdlet for but compare the output of

PS> ls hklm:\software

    Hive: HKEY_LOCAL_MACHINE\software

SKC  VC Name                           Property
---  -- ----                           --------
  5   0 Adobe                          {}
  2   0 Atheros                        {}
  1   0 ATI Technologies               {}
  1   0 AVG                            {}

 

and

 

PS> Resolve-Path hklm:\software\*

Path
----
HKLM:\software\Adobe
HKLM:\software\Atheros
HKLM:\software\ATI Technologies
HKLM:\software\AVG

and I’m getting a few ideas of where it might be useful

Technorati Tags: PowerShell,Paths

Leave a Reply