pushd
Windows CMD · Directories · reference only
What it does
Saves the current directory on a stack and changes to another one, so you can return later with popd. With a network path it creates a temporary drive.
Syntax
pushd [ruta]
Options and parameters
rutaDirectory to change to; the current one is saved on the stack.
\\servidor\recursoNetwork path: assigns a temporary drive letter and moves to it.
(sin argumentos)Shows the contents of the directory stack, if command extensions are enabled.
Usage examples
pushd C:\Windows\System32Goes to System32 and remembers where you came from.
pushd \\servidor\compartidoEnters a network resource with a temporary drive.
pushdShows the directories saved on the stack.
popdGoes back to the previous directory.
Notes and common mistakes
- It is useful in .bat scripts that need to work in another folder and leave the environment as it was.
- Each pushd should be paired with a popd.