Get-Location
Show the current folder
Get-Location
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Get-Location
Shows the current folder. Every relative path (.\docs, ..\backup) is relative to this.
The prompt usually shows it too: PS C:\Path\To\Folder>. The automatic variable $PWD holds the same value.
Try this
Get-Location
Set-Location -Path ..
Get-Location
Jump somewhere and come back:
Push-Location -Path $env:TEMP
Get-ChildItem
Pop-Location
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | pwd |
| cmd.exe | cd |
More in From bash and From cmd.