PUSHD

Change the current directory/folder and store the previous folder/path for use by the POPD command.

Syntax
      PUSHD pathname 
   
Key
   pathname - the folder to make 'current' (UNC names accepted)

Example

@Echo Off
Setlocal
Set _folder=%1
Pushd %_folder%
:: Now verify we really moved to the new folder
If /i not "%cd%"=="%_folder% (Echo folder not found &goto :eof)
Echo We are at %cd%
Popd
Echo We are back at %cd%


Networks
When a UNC path is specified, PUSHD will create a temporary drive map and will then use that new drive.

Temporary drive letters are allocated in reverse alphabetical order
so if Z: is free it will be used.

If Command Extensions are disabled the PUSHD command will not accept a network (UNC) path.

#Ah, push it - push it good
Ah, push it - p-push it real good# - Salt 'N' Pepa

Related:

CD - Change directory
CMD - UNC options
PROMPT - Display the level of the PUSHD stack
Powershell: Push-Location - Push a location to the stack (pushd)
Equivalent bash command (Linux): pushd - Save and then change the current directory



Back to the Top

© Copyright SS64.com 1999-2010
Some rights reserved