Purpose:Save the current disk drive and directory, optionally changing to a new drive and directory


Format:PUSHD [/N /R /X path | :folder]


pathThe name of the new default drive and directory.
folderA Windows Shell folder name


/N(o directory change)

/R(eparse point)

/X (exclude)


See also: DIRS, POPD, @DIRSTACK and Directory Navigation.


File Completion Syntax:


The default filename completion syntax is: dirs




PUSHD saves the current drive and directory to a "last in, first out" directory stack. The POPD command returns to the last drive and directory that was saved by PUSHD. You can use these commands together to change directories, perform some work, and return to the starting drive and directory. The DIRS command displays the contents of the directory stack.


To save the current drive and directory, without changing directories, use the PUSHD command by itself, with no path.


If a path is specified as part of the PUSHD command, the current drive and directory are saved and PUSHD changes to the specified drive and directory. If the path includes a drive letter, PUSHD changes to the specified directory on the new drive without changing the current directory on the original drive.


PUSHD supports Windows shell folder names; see CDD for details.


When you use PUSHD to change to a directory on an LFN drive, you must quote the path name if it contains white space or special characters.


PUSHD can also change to a network drive and directory specified with a UNC name (see File Systems for details).


If PUSHD cannot change to the directory you have specified it will attempt to search the CDPATH and the extended directory search database. You can also use wildcards in the path to force an extended directory search. Read the section on Directory Navigation for complete details on these and other directory navigation features.


Directory changes made with PUSHD are also recorded in the directory history list and can be displayed in the directory history window.


The directory stack can hold up to 16383 characters, or about 500+ typical entries (depending on the length of the names). If you exceed this limit, the oldest entry is removed before adding a new entry.




Save the current directory and change to C:\WORDP\MEMOS, then return to the original directory:


[c:\] pushd \wordp\memos

[c:\wordp\memos] popd





/NPush the directory onto the stack, but don't change the directory.


/RChange to the target of the reparse point (hard link or symbolic link).


/XDon't save the current directory to the Directory History list.