pushd and popd
popd are commands used to work with the command line directory stack. They are available on command-line interpreters such as 4DOS, Bash, Command Prompt and PowerShell for DOS, Microsoft Windows, ReactOS, and in Unix-like operating systems.
|Original author(s)||Bill Joy|
|Operating system||Unix and Unix-like, DOS, Windows, ReactOS|
pushd command saves the current working directory in memory so it can be returned to at any time, optionally changing to a new directory. The
popd command returns to the path at the top of the directory stack. This directory stack is accessed by the command
dirs in Unix or
Get-Location -stack in Windows PowerShell.
In Windows PowerShell, pushd is a predefined command alias for the
Push-Location cmdlet and popd is a predefined command alias for the
Pop-Location cmdlet. Both serve basically the same purpose as the Unix-like
Both commands are available in FreeCOM, the command-line interface of FreeDOS.
pushd [path | ..]
pathThis optional command-line argument specifies the directory to make the current directory. If
pathis omitted, the path at the top of the directory stack is used, which has the effect of toggling between two directories.
[user@server /usr/ports] $ pushd /etc /etc /usr/ports [user@server /etc] $ popd /usr/ports [user@server /usr/ports] $
Microsoft Windows and ReactOS
C:\Users\root>pushd C:\Users C:\Users>popd C:\Users\root>
DOS batch file
@echo off rem This batch file deletes all .txt files in a specified directory pushd %1 del *.txt popd echo All text files deleted in the %1 directory
- Pushd - change directory/folder - Windows CMD - SS64.com
- Popd - Windows CMD - SS64.com
- Bash Reference Manual: Directory Stack Builtins
- Microsoft TechNet Pushd article
- Microsoft TechNet Popd article
- man tcsh "TCSH(1)". Archived from the original on 2014-03-10. Retrieved 2014-11-03.
|Wikibooks has a book on the topic of: Guide to Windows Commands|