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
- 5 Linux commands every sysadmin needs to knowin a world full of new tools and diverse development environments, learning some basic sysadmin commands is practically essential for any developer or engineer.
- How to run Linux commands when starting Windows Subsystem for Linux on Windows 10the latest beta version of windows 10 allows users to automatically run linux commands when windows subsystem for linux starts.
- Use commands and some tips for Mac OS Xin this tutorial we will show you how to use some commands and tips for mac os x.
- Complete list of Rundll32 commands in Windows 11this tutorial will show you the complete list of rundll32 commands that can be used to create shortcuts or directly open various dialog boxes and wizards in windows 11.
- Instructions for quickly opening Windows applications using the Run commandwhen you need to quickly open an application in windows, we often use keyboard shortcuts. however, few people know that there is still another way, that is to use the run command. there are many commands in run to open different applications in windows but the most common are 5 commands to open the following applications. please consult.
- Run remote commands on Cisco routers from the computercan you place the cursor at the windows command prompt and run a command on the router? usually, you will first have telnet or ssh to connect to the router to be able to execute commands? this article will show you how to simultaneously run router commands without having to exit the windows command prompt, which is very convenient for control and
- 99+ entertaining AI commandsyou can ask ai to create more for games you already know like monopoly, chinese chess, chess... or set up games, travel and more.
- How to open RUN dialog box and 60+ common commands on Windowssummary of 63+ frequently used run commands on computers win xp, 7, 8, 8.1 and windows 10 ... using the run command will help you use windows more effectively and quickly.
- Guide to network operation for Linux users: 11 commands to knowlinux supports commands to download files, diagnose network problems, manage network interfaces or view network statistics on the terminal. here are some common linux commands to work with, please consult.
- 7 commands to manipulate the most basic files and folders everyone must knowon windows or linux operating systems, there are a number of things that users can only do with commands. in the following article, the network administrator will introduce you to the 7 most basic commands that any user must 'understand' to perform operations faster.