Open E3V3A opened 4 years ago
A limited version of this is natively in PowerShell 6.2 and above- PowerShell 6.2 added support for - and + with the Path parameter. PowerShell maintains a history of the last 20 locations that can be access with - and +, though it can't jump to numbered locations and weirdly there doesn't seem to be a way to display the stack...
There's a version of Set-Location
called Set-LocationEx
in Pscx that I think does everything you're after, though https://github.com/Pscx/Pscx/blob/master/Src/Pscx/Modules/CD/Pscx.CD.psm1#L78
Better than this would be to see what is on the stack (after popping the stack with "z -", the stack will be different than the list of recently visited directories). I see the comment above about no way to display the stack, I thought "Get-Location -Stack" was supposed to do that...
I love lists. The Bash similar (but not default)
cd --
give you a list of the (up to) 10 last directories you've been to. You can then usecd -3
to go to the 3rd last one.I have documented this here, and would love to see this in Powershell.