pushd ?dir?

pushd is one of the Tclx extended tcl commands. It is used to push the current directory onto a directory stack that can be used with cd. This permits one to keep track of a series of directories one has visited (with the help of dirs), and then do a popd to get directories off of the stack.

KPV I've never found pushd to be very useful on DOS/Windows because of file volumes and how each volume has it's own current directory. Using pushd has the unwanted side-affect of likely changing the current directory of the volume you're changing to. For example, if the current directory on volume F: is say "f:\myDirectory" and I call pushd f:\temp then popd and sometime later go back to that volume via f:, I'll be put into the directory "\temp" rather than "\myDirectory".

In fact, when I do need pushd's functionality, I end up needing to call it twice: once to get to the right volume, then to get to the right directory (and don't forget you'll need to call popd twice).

FEG I find pushd/popd particularly useful in a situation where your working directory is some elaborate path that you want to avoid having to recall (either interactively or programmatically). Just pushd to where you need to be for some command, run the command, then popd and you're right back where you started.

See also