I've blogged a few times about how cool PUSHD (and POPD) is from the cmd.exe prompt. It's one of the most powerful "DOS" commands that few folks use.
PUSHD, of course, maintains a stack of where you are in your file system. It will PUSH a directory on the stack and move you there automatically. Combined with a PROMPT variable that includes (somewhere) a $+, you'll get a very powerful way to move about.
Example from CMD>EXE:
C:\Documents and Settings\Scott>PUSHD c:\windowsC:\WINDOWS+>pushd system32C:\WINDOWS\system32++>popdC:\WINDOWS+>popdC:\Documents and Settings\Scott>
One thing that I don't see a lot is PUSHD with UNC Paths, and how it will automatically map a drive for you, starting at Z: moving backwrads and will unmap them when you POPD.
Example from CMD.EXE:
C:\Documents and Settings\Scott>PUSHD \\SCOTTPC\DZ:\+>PUSHD \\SCOTTPC\DESKTOPY:\++>POPDZ:\+>POPDC:\Documents and Settings\Scott>cd \\scottpc\desktop'\\scottpc\desktop'CMD does not support UNC paths as current directories.
But, of course, I can't CD to a UNC path with CMD.EXE.
However, all these scenarios, plus CD'ing to UNC paths work within Powershell:
PS C:\Documents and Settings\Scott> pushd \\scottpc\desktopPS Microsoft.PowerShell.Core\FileSystem::\\scottpc\desktop> cd \\scottpc\dPS Microsoft.PowerShell.Core\FileSystem::\\scottpc\d> cd \\scottpc\desktopPS Microsoft.PowerShell.Core\FileSystem::\\scottpc\desktop> c:PS C:\Documents and Settings\Scott> PUSHD \\SCOTTPC\DPS Microsoft.PowerShell.Core\FileSystem::\\SCOTTPC\D> PUSHD \\SCOTTPC\DESKTOPPS Microsoft.PowerShell.Core\FileSystem::\\SCOTTPC\DESKTOP> POPDPS Microsoft.PowerShell.Core\FileSystem::\\SCOTTPC\D> POPDPS C:\Documents and Settings\Scott> cd \\SCOTTPC\DESKTOP
Nice stuff to know. Thanks to Ryan Carr for the reminder.