Powershell has $PWD and also Get-Location, both effectively returning the current "shell location" (as opposed to [System.Environment]::CurrentDirectory).
$PWDis documented as:
Contains a path object that represents the full path of the current directory location for the current PowerShell runspace.
And Get-Locationis documented as:
gets an object that represents the current directory, much like the print working directory (pwd) command.
Neither doc page mentions the other option.
So is there any difference in the value they produce? Possibly with multiple runspaces?
@Santiago answered this in the comments:
$pwdis pretty muchGet-Locationwith no parameters, both output$PSCmdlet.SessionState.Path.CurrentLocationbut the cmdlet allows to get your location in different providers, psdrives and stacks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With