Monthly Archive

Categories

Resolve-Path

Resolve-Path is a cmdlet I haven’t used much – if at all – so I thought I should have a look at it.

At an arbitrary point in the file system:

PS> Get-Location

Path
----
C:\Scripts\Modules\Coordinates

 

.. Indicates the next level up

PS> Get-ChildItem -Path ..

Directory: C:\Scripts\Modules

etc

 

..\.. indicates two levels up

PS> Get-ChildItem -Path ..\..

Directory: C:\Scripts

etc

 

Resolve-Path will resolve any use of wildcards and other characters with meaning into the full path

PS> Resolve-Path -Path ..

Path
----
C:\Scripts\Modules

 

PS> Resolve-Path -Path ..\..

Path
----
C:\Scripts

 

Note that

PS> Resolve-Path -Path .

Path
----
C:\Scripts\Modules\Coordinates

 

is effectively the same as Get-Location

Comments are closed.