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

  • ruta

    Directory to change to; the current one is saved on the stack.

  • \\servidor\recurso

    Network 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\System32

    Goes to System32 and remembers where you came from.

  • pushd \\servidor\compartido

    Enters a network resource with a temporary drive.

  • pushd

    Shows the directories saved on the stack.

  • popd

    Goes 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.

Related commands