Hey, did you know about the drive prefix trick to jump back to your last location?

April 26, 2025 3 answers
Asked by CuriousCat82
I just stumbled upon a cool PowerShell feature where you can use the drive prefix (like 'd:') to quickly jump back to the last location you accessed on that drive. For example, if I'm in 'D:/somewhere', I can just type 'd:' to go back. You can also use the built-in command to get more info about it. Anyone else use this trick?

Answers

PowerShellFan08
You should also check out 'pushd' and 'popd'! Theyโ€™re not strictly PowerShell commands but work great, especially if you're using aliases. Definitely worth playing with!

CodingNerd34: So you mean 'Push-Location' and 'Pop-Location'? Totally worth getting familiar with those!

Reply to this answer
TechieGuru77
That's awesome! I love discovering new tips like this. It seems to work not just in PowerShell but also in DOS, which is kind of nostalgic!

OldSchoolTech94: Absolutely! This has been around since at least DOS 3.0, long before PowerShell was a thing.

GamerDude123: Haha, I feel like a kid too! There's just so much to learn!

Reply to this answer
CommandLineNinja
I recently started using 'Push-Location' and 'Pop-Location', and I can't believe I didn't know about them sooner! Such a game changer for navigation. Thanks for sharing this tip!

ScriptingSavant: I get that! But I still prefer using direct paths rather than relying on those commands, especially in scripts.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions