Popd and pushd commands in Windows
(Applies to Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012).
Popd command
Change the current directory to the folder stored most recently by the pushd command.For a better understanding of how to use this command, see the example below.
Syntax popd
Popd
Popd command parameter
Parameters
Describe
/?
Show help at thecommand prompt.
Popd command comment
- Each time you use the pushd command, a single directory will be stored for you to use. However, you can still store multiple directories using the pushd command multiple times. Folders are stored sequentially in a virtual stack. If you use the pushd command once, the directory you use is located at the bottom of the stack. If you use the command again, the second folder is located at the top of the first folder. The process will be repeated every time you use the pushd command. Alternatively, you can use the popd command to change the current directory to the directory stored most recently by the pushd command. If you use the popd command, the folder at the top of the stack will be deleted from the stack and the current directory will be changed to that folder. If you use the popd command again, the next folder on the stack will be deleted.Just like that.
- When the command extensions are enabled, the popd command will remove any drive letter assignments created by pushd .
Example popd command
The following example shows how you can use the pushd command and the popd command in abatch program(batch program)to change the current directory from a directory on which the batch program is run.Then change back:
@echo off
rem This batch deletes tập tin .txt trong một thư mục đã ghi rõ
pushd% 1
del * .txt
popd
cls
echo các tập tin văn bản đã xóa trong% 1 thư mục
Pushd command
Store the current directory for use by the popd command, and then change the specified directory.For a better understanding of how to use this command, see the example below.
Syntax pushd command
pushd []
Pushd command parameter
Parameters
Describe
Specify the directory to create the current directory.This command supportsrelative paths.
/?
Show help at thecommand prompt.
Pushd command comment
- Each time you use the pushd command, a single directory is stored for you to use. However, you can also store multiple directories using the pushd command multiple times. Folders are stored sequentially in a virtual stack. If you use the pushd command once, the directory you use is located at the bottom of the stack. If you use the command again, the second folder is located at the top of the first folder. The process will be repeated every time you use the pushd command.
- Alternatively, you can use the popd command to change the current directory to the directory most recently stored by the pushd command. If you use the popd command, the folder at the top of the stack will be deleted from the folder. The current directory and directory will be changed to that folder. If you use the popd command again, the next folder on the stack will be deleted.Just like that.
- If the command extension is enabled, the pushd command will accept either the network path or the local drive letter and path.
- If you specify a network path, the pushd command temporarily assigns the highest unused drive letter (starting with Z :) to the specified network resource. The command then changes the current drive and directory to the specified folder on the newly assigned drive. If you use the popd command with extended command utilities enabled, the popd command will delete the drive letter created by pushd .
Example pushd command
The following example shows how you can use the pushd command and the popd command in abatch program(batch program)to change the current directory from a directory on which the batch program is run.Then change back:
@echo off
rem This batch deletes tập tin .txt trong một thư mục đã ghi rõ
pushd% 1
del * .txt
popd
cls
echo các tập tin văn bản đã xóa trong% 1 thư mục
See more:
- Netcfg command in Windows
- Nbtstat command in Windows
- Bitsadmin create command in Windows
- The nlbmgr command in Windows
You should read it
May be interested
- The chkntfs command in Windowsthe chkntfs command displays or modifies the automatic disk check when the computer starts. if used without options, the chkntfs command will display the file system of the specified drive.
- Bitsadmin command getowner, get priority and getproxybypasslisttoday's article will introduce 3 commands: bitsadmin getowner, bitsadmin get priority and bitsadmin getproxybypasslist.
- PowerShell command in Windowswindows powershell is an executable command line and a scripting language specifically designed for system administrators.
- How to check whether spare batteries are allowed to be carried on boardtoday, the demand for smartphones is extremely large, we almost have to use smartphones anytime, anywhere, from entertainment purposes to work.
- Bitsadmin command getproxylist, getproxyusage and getreplydatatoday's article will introduce 3 commands: bitsadmin getproxylist, bitsadmin getproxyusage and bitsadmin getreplydata in windows.
- PowerShell_ise command in Windowswindows powershell integrated scripting environment (ise) is a graphical storage application that allows you to read, write, run, debug and check scripts and modules in a graphical support environment.