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

This entry was posted in Powershell. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s