Change the current directory/folder and store the previous folder/path for use by the POPD command.
Syntax
PUSHD [drive]path
PUSHD
Key
drive The drive to switch to
path The folder to make 'current' (UNC names accepted)
If the drive is not specified, the current drive will be assumed.
If neither drive nor path are specified PUSHD will display a list of previous pathnames, you may switch back to any of these by using POPD one or more times.
If the path specified does not exist, PUSHD will return %errorlevel% =1
Examples
C:\demo> pushd \work C:\work> pushd F:\music F:\music> pushd C:\work>
C:\demo> F:\music> popd C:\work>
Network paths
When a UNC path is specified, PUSHD will create a temporary drive map and will
then use that new drive.
The temporary drive letters are allocated in reverse alphabetical order,
so if Z: is free it will be used first.
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)
Powershell: cd - Jump to the previous working directory
Equivalent bash command (Linux): pushd - Save and then change the current directory