Using Get-location to provide only the path

Get-location provides the current path we are working

PS C:\Users\HP> get-location

Path
----
C:\Users\HP

How can we get only the Path like ‘C:/Users\HP’

Have you at least tried to look for an answer yourself? :face_with_diagonal_mouth:

Get-Location | Select-Object -ExpandProperty Path
(Get-Location).Path
$Location = Get-Location
$Location.Path
1 Like

You can also use the automatic variable $pwd for this:

$pwd.Path