Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

Work with the PowerShell location stack

Tags: powershell

If you navigate among directories a lot, the following will be useful. Here is an example workflow.

  1. Save your current directory with push-location
  2. Go to another directory with cd <path>
  3. Return the your initial directory with pop-location

Push-Location <path>

  • add the current location to the location stack
  • then, change the directory to <path>

Get-Location -Stack

  • show the locations on the default location stack

Pop-Location

  • remote the top location from the location stack
  • then, change the directory to that location